From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to code to remember last choice with Combobox?

Solved!
Go to solution

Hello:

I want to let combobox remember text of last selection.

My present method is using editbox cooperate with combobox, which is not beautiful and tidy. Do you have any better tips to achieve this function?

 

Thanks in advance.

Dina Ding

0 Kudos
Message 1 of 3
(2,236 Views)

Hi,


I personally use some Diadem variable such as R1 R2.. R30, O1..O10 etc. Then your choice changes this variable, which is what initiates the combobox value.

 

I hope it helps.

 

L911

0 Kudos
Message 2 of 3
(2,210 Views)
Solution
Accepted by topic author DinaDing

Hi Dina,

 

Your two main options are to use a global DIAdem variable (RAM) or to use file I/O to cache the dialog state in an ASCII or XML file.  For the global variable approach, the default temporary variables (L1, R1, T1...) are particularly convenient because they're already declared any time DIAdem starts.  You can use your own global variables instead though, just make sure you GlobalDim() them before the SUDialog is first invoked from a DIAdem VBScript.  You either associate such global variables 1 to 1 with each of the SUDialog controls, or you can use the dialog initialization event or the individual control initialization events to explicitly read the global variable state and assign it to the control.  For the file I/O option you'd want to use the dialog initialization event to read all the control states from the ASCII or XML file and assign them all.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 3
(2,205 Views)