Retrieve the value of a variable with VB


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.




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


RE: Retrieve the value of a variable with VB


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:




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


Good luck!



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