Change text in multiple text boxes?

Started by James Padgett, March 05, 2011, 11:43:48 AM

Previous topic - Next topic

James Padgett

Are these two methods by best options for doing this?

Say I have 5 text boxes, FF_FORM1_Text1,...Text2 ...  etc...
If I want to set the text for each of them based on a loop counter say...
For x = 1 to 5
if x = 1 then FF_TextBox_SetText (HWND_FORM1_TEXT1, "One")
if x = 2 then FF_TextBox_SetText (HWND_FORM1_TEXT2, "Two")
if x = 3 then FF_TextBox_SetText (HWND_FORM1_TEXT3, "Three")

Or
Select Case x
   Case 1
        FF_TextBox_SetText (HWND_FORM1_TEXT1, "One")
   Case 2
        FF_TextBox_SetText (HWND_FORM1_TEXT2, "Two")
....




Robert Eaton

I'm certainly not the expert in the room here, but best in what respect?

Select case is probably going to be faster if you're dealing with integers. :-\

Rolf Brandt

You could use a textbox array: Text1(0), Text1(1), etc.
and then
FF_TextBox_SetText (HWND_FORM1_TEXT1(x), TheText)

Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Jim Dunn

I know Rolf meant:

   for x = 1 to 5
      FF_TextBox_SetText( HWND_FORM1_TEXT1(x), TheText(x) )
   next x

: )
3.14159265358979323846264338327950
"Ok, yes... I like pie... um, I meant, pi."

James Padgett

Sweet!!!!
I wasn't aware I could address controls that way...

Thanks....

David Kenny

James,

Copy a control, then paste... A dialog will ask you if you want to create a control array.  Select yes. Pasting again will create a third one.  One thing you need to check is the sequence of the values in the Control Index Properties and, in the case of an option group, the Index Properties. Pasting controls, especially if you copy and paste multiple controls at a time, can leave those properties needing a manual touch up.  That should get you started.

David