Click to See Complete Forum and Search --> : I have a fixed size number of controls ( textBox ) and I need to disable some of them


udir
January 23rd, 2003, 02:47 AM
Thanks, Udi

DaddyGweedo
January 23rd, 2003, 09:00 AM
You need to be more specific.

textbox1.Enabled = False

that's the easy way.

to completely remove it from view:
TextBox1.Visible = False

Here is a more complex example that will allow you to go through all the boxes on a given form and allow you to do what ever you need to. For example check the text to see if it should be disabled.

Dim aControl As Control
For Each aControl In Me.Controls
If (aControl.GetType().ToString().Equals("System.Windows.Forms.TextBox")) Then
'code to text boxes here.
'use aCountrol to get to properties.
aControl.Enabled = False
End If
Next

This is not the best method, but it will work. You could also use the typeof() function.

Good luck