Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

do .visible = true

Status
Not open for further replies.

enque

Civil/Environmental
Dec 7, 2002
20
I want to do visible a range of textboxs.
each box is called txtm01, txtm02, txtm03 .....
I want to make a loop that makes visible and invicible some
range of boxs.
So I tried this code, but the machine got stuck
what Im doing wrong?
''''''''''''''''''
Do
z = 0 + z
z1 = "txtm0" & z
z2 = z1 & ".Visible = True"
Loop Until z = 1
''''''''''''''''''''''''''''''''''''
Here I want to make visible the textboxs= txtm00 and txtm01
 
Replies continue below

Recommended for you

I would suggest using a control array in this case. You can loop through the textboxes and change any of its (their) properties. Look up 'control array' in the help files, it can give you specifics of how to use them.

In your current code you have an infinite loop situation because the value of 'z' never increments (z = 0 + z just isn't going to do it).
 
You can give the same name to all TextBox-es you want. Once you use the same name textbox-es will have an index. then you can work with them ysint that index.

e.g.

TextBox(1).Visible = True
TextBox(2).Visible = False


Vlado
 
You can also loop through the Controls collection;

Dim X As Control
For Each X In Me.Controls
If TypeOf X Is TextBox Then
X.Visible = False
End If
Next

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting
 
Does visual basic.net support indexes?????//
If so ,how""????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor