1

Hi,

I want to set Textbox1 to textbox 55 to .readonly =true by using says For loop,so i need not key in one by one. Any ways to do it?

I know sonthing like

For index As Integer = 1 To 55
            Me.b.Controls("Textbox" & index).Text = index
            Me.b.Controls("Textbox" & index).TabIndex = index
               Me.b.Controls("Textbox" & index). = index
  Next

but inside .control doesnt have .readonly.....Any similiar command or ways to do it?
Thanks in advance

5
Contributors
6
Replies
11
Views
6 Years
Discussion Span
Last Post by crazyhorse09
0

Hi,

You can work around and use enabled and set backcolor to white.
Here's an example:

For Each ctrl As Control In Me.Controls
            If TypeOf ctrl Is TextBox Then
                ctrl.Enabled = False
                ctrl.BackColor = Color.White
            End If
        Next
0

>How to set Multiple textbox property's Readonly

For Each t As TextBox In Me.Controls.OfType(Of TextBox)()
 t.ReadOnly = True
Next
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.