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

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

>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.