07-01-2016 04:17 AM
Hi
I have made an dialog with listbox and declared and variable for this ListBox2Out test as variant.
In this listbox there is added some text into this.
If i make an Ok event with msgbox (Listbox1.text) then I get all selected values in text from the listbox.
But how do I transfer this selections to the main code.
I have tried this but then I only get the index from the listbox which have been selected but not all the text
How to i get the same information from the Listbox1.Text into the main code.
If Not ItemInfoGet("ListBox2Out") Then
Call GlobalDim("ListBox2Out")
End If
If SudDlgShow("Input2_CPK",CurrentScriptPath & "Dialog - Copy") = "IDOk" Then
Call msgbox ("ListBox2Out:"+str(ListBox2Out))
End If
07-01-2016 03:32 PM
Hi Reol,
It looks like you're close. You just need to explicitly fill the global variable you created in the VBScript somewhere in the callback code of the SUDialog.
ListBox2Out = Listbox1.Text
Any assignment to a global variable (declared with GlobalDim in the calling VBScript) will automatically transfer between the VBScript and the SUDialog and back to the VBScript.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
07-04-2016 06:00 AM
Hi
After I set i SUD for OK_Event
Listbox1Out=Listbox1.text
msgbox ("Out:"+Listbox1Out)
This popup with all the selected text from the listbox.
In the main code i have following:
GlobalDim("Listbox1Out")
msgbox ("Test:"+Listbox1Out)
Then I only get the index from the Listbox and not the ListBox1.text
07-11-2016 03:20 AM
Thanks it works 🙂