Cool.
Got an example in the VB API examples installed with Creo that I chaged a bit.It works!Stoked!Started out with Excel VB script and trying to move onto using Visual studio.
For interest sake here is the Submit Button code I use with the Sub Code.I use the createParametersFromStrings and createParametersFromStrings functions(also included):
Private Sub BSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BSubmit.Click
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim session As pfcls.IpfcBaseSession
Dim mdl As pfcls.IpfcModel
Dim powner As pfcls.IpfcParameterOwner
Dim matNum As String
matNum = cbMatNumber.Text
asynconn = CreateObject("pfcls.pfcAsyncConnection")
conn = asynconn.Connect("", "", ".", 5)
session = conn.Session
mdl = session.CurrentModel
powner = CType(mdl, pfcls.IpfcParameterOwner)
createParametersFromStrings(powner, matNum, "MATERIAL")
conn.Disconnect(2)
End Sub
Private Function createParametersFromStrings(ByVal s As String) _
As IpfcParamValue
Try
Return ((New CMpfcModelItem).CreateStringParamValue(s))
Catch ex As Exception
MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
Return Nothing
End Try
End Function
Public Sub createParametersFromStrings(ByRef pOwner As IpfcParameterOwner, ByVal VBMaterialNumber As String, ByVal CreoParamName As String)
Dim pv As IpfcParamValue
Dim p As IpfcParameter
Try
'=========================================================== ===========
'Use a stream reader to read the properties file
'=========================================================== ===========
'file = New IO.StreamReader(propertiesFile)
'=========================================================== ===========
'Read and parse line into key - value pairs. These are separated by
'":". Any line starting with # is ignored as comments
'=========================================================== ===========
'=========================================================== ===
'Invalid key - value pairs are ignored
'=========================================================== ===
pv = createParamValueFromString(VBMaterialNumber)
p = pOwner.GetParam(CreoParamName)
If p Is Nothing Then
pOwner.CreateParam(CreoParamName, pv)
Else
CType(p, IpfcBaseParameter).Value = pv
End If
Catch ex As Exception
MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
Finally
End Try
End Sub
End Class