DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

listbox

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

 

 

0 Kudos
Message 1 of 4
(3,779 Views)

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

0 Kudos
Message 2 of 4
(3,758 Views)

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

 

 

0 Kudos
Message 3 of 4
(3,732 Views)

Thanks it works 🙂

0 Kudos
Message 4 of 4
(3,672 Views)