How to disable all the TextBox in GroupBox in vb.net form

Raaj Baherh :

I have a vb.net form in which i added a GroupBox including 10 TextBox. I want to disable 9 TextBox at the load time and a single TextBox should be enable.

Mary :

Normally you would be required to show what you have tried. Next time please do that.

Create an array of the text boxes you want to disable. Then loop to the array setting each box's enabled property to False.

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim boxes = {TextBox1, TextBox2}
    For Each tb In boxes
        tb.Enabled = False
    Next
End Sub

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=405223&siteId=1