cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

How to transfer Combobox (selected) item to Parameter value? (VB api)

bdijkstra
4-Participant

How to transfer Combobox (selected) item to Parameter value? (VB api)

I'm trying to get an selected item from a ComboBox to an specific Parameter value:


ComboBox1.text=ComboBox1.SelectedItem.Value   

parameter(12) = mdl.GetParam("Parameter1")

pvalue(12) = (New CMpfcModelItem).CreateStringParamValue(ComboBox1.Text)

CType(parameter(12), pfcls.IpfcBaseParameter).Value = pvalue(12)


Now I'm getting the following Toolkit Error:

ComboBox1_error.JPG



This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 REPLY 1

Without seeing any declerations of your objects and variables the error can pretty much be anything.

parameter(12) indicates some type of array but i can not see the type

Try something like this...

Dim CBText as String = ComboBox1.text

Dim parameter As IpfcParameter

Dim paramValue As IpfcParamValue

parameter = mdl.GetParam("Parameter1")

' Get param type
Dim type As String = PDUtils.getTypeFromParam(CType(parameter, IpfcBaseParameter).Value)

' Create param value
paramValue = PDUtils.createParamValue(CBText, type)
 
' Set param value
CType(parameter, IpfcBaseParameter).Value = paramValue

Top Tags