Retrieve the value of a variable with VB

Valued Contributor
Valued Contributor

 

I want to retrieve the value of a variable using Visual Basic. I think GetValue is what I want but I am absolutely clueless as to how to use it. Please help.

Thanks

Terry

 

Posted by: Terry Tyson
Post date: 6/3/2010 12:01:29 PM

1 REPLY

RE: Retrieve the value of a variable with VB

Valued Contributor
Valued Contributor

 

Yes, you can use GetValue,

like this:

 

Dim oSEApp As SolidEdgeFramework.Application = GetObject(, "SolidEdge.Application")

Dim oDoc As SolidEdgeAssembly.AssemblyDocument = oSEApp.ActiveDocument

Dim vName As String = "*" 'or another string for the Name

Dim vValue As String

Dim oVars As SolidEdgeFramework.Variables = oDoc.Variables

Dim oVarList As SolidEdgeFramework.VariableList

Dim oVar As SolidEdgeFramework.variable

 

oVarList = oVars.Query(vname)  'is not needed, if you want to get a Type "Var":

'the first item in the list

oVar = oVarList.Item(1)

'or direct without VariableList, but only for Type Var:

'oVar=oVars.Item(yourName)

 

oVar.GetValue(vValue)

MsgBox(oVar.Name & " = " & vValue)

 

Good luck!

JR

 

Posted by: JR
Post date: 6/7/2010 12:04:23 AM