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

and

.enabled = false

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

Cool^^ That Helps alot

I was going to ask a similar question, so that helps me a lot too, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.