Re: How can I run over controls dynamically ?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Instead of six separate controls, create an array of text boxes. To do
this, create the first one with the proper name and features like size,
font, etc. and then copy and paste it back on to the form. When the
message pops up asking you if you want to create a control array, say
Yes. Now paste 4 more times. You will end up with txtFax(1), txtFax(2),
etc. Now looping through them will be a breeze.

Scott


DavidE wrote:
Hi,

I put on a form 6 textboxes and I try to check their text property value in
a loop . I want to do it dynamically without using Case statements.
The name of the textBoxes are :
txtFax1,txtFax2,txtFax3,txtFax4,txtFax5,txtFax6.
I use this code :
For i= 1 to 6
If Not ("txtFax" & i).Text = "" Then ' It's doesnt work like this b
.....
End If
Next

I have an error in this line: If Not ("txtFax" & i).Text = "" Then
because "txtFax" & i is a string, not a text box
How can I do it dynamically ?

Thanks,
David

.



Relevant Pages

  • Re: Airport keeps switching to neighbors linksys
    ... wherein "Always remember new networks" is set to 1 and JoinMode is ... menu option to select the proper type of encryption - that it to force ...
    (comp.sys.mac.system)
  • Re: Get data of internal data representation of primitive type
    ... I must allocate them of the proper type(which I can't because I can't do ... ReadValueType(stream, numo); ... that is my code right now to handle an array. ... (basically if val is an array of value types then Deserializesub will get it ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: $# array creation and data rotation
    ... ,, array to ONLY 10 values? ... If you want a language with "proper" ways of doing certain things, ... ,, now, as data comes in via the serial port ... ,, first want to "shift" the data: ...
    (comp.lang.perl.misc)
  • Array of structures
    ... I want to build an array of this structure but the number of employees ... I know I need to first allocate the structure and then allocate the ... struct Company CompArray; ... I guess my questions pertain to proper allocation of the structure and ...
    (comp.lang.c.moderated)
  • Re: Allocating Four Dimensional Dynamic Arrays...
    ... The array is initialized in the pyramid structure and the remaining ... |> proper results. ... | I'm confused about what you want, but here some code that allocates a 4D ... It's the same as your 2D code but expanded to 4 dimensions. ...
    (comp.lang.cpp)