DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

treat editboxes as array

Hi
 
I have a SUD dialog with a number of editboxes - editbox1 to editbox13 - can I treat the edit boxes as if they are an array so can set the contents in a loop
 
for example editbox(i).text = text
 
I've tried but with no success and was wondering if I was missing something obvious.
 
 
Thanks
 
Nick
0 Kudos
Message 1 of 5
(4,137 Views)
Hello Nick!
 
The way you have tried is not implemented but there is a solution with the VBS command 'Eval'. Eval evaluate an text expression during runtime an returns the result.
 
Try this code:
Dim i
 
For i=1 To 13
  Eval("Editbox"&i).Text = i
Next
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 5
(4,136 Views)

Hi Matthias

Problem solved

Thanks for the help

Nick

 

 

0 Kudos
Message 3 of 5
(4,132 Views)

Hi Nick,

Note also that there is a similar command called "Execute" that runs the rest of that command line after parsing it.  Alternatively, you could use a table control in your SUDialog, and then you could really address those cells like an array, though you have much less flexibility that way in the vertical or horizontal arrangement of the text boxes.

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 5
(4,109 Views)
Hello!
 
Brad is - as always - right! It is possible to use Execute instead. IMHO Eval is a little bit better because you are not running into problems with string delimiters, you can assign the Eval result to a variable or use it in a with command and the code is much more readable.
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 5 of 5
(4,100 Views)