2
Contributors
4
Replies
8
Views
5 Years
Discussion Span
Last Post by Shodow
1

See if this helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each txt In New TextBox() {TextBox1, TextBox2, TextBox3} '// your TextBoxes.
            If txt.Text = "" Then Exit Sub '// skip remain code in Sub.
        Next
        Button2.Enabled = True '// enable if all TextBoxes have values.
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button2.Enabled = False
    End Sub
Votes + Comments
Great help for sure :)
0

so you have to click button1 first to validate the textbox?

0

For my posted code, you do.
If you need to have it trigger when typing in TextBoxes, add the code to the TextChanged event of the TextBoxes.

Private Sub _TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged, TextBox3.TextChanged ', TextBoxETC.TextChanged
        '// validate TextBoxes code here.
    End Sub

Edited by codeorder: n/a

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.