Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15537

VS 2019 If Statement IS Not Working After For Next

$
0
0
Hello,
I am trying to figure out why if statement is not working after the For-next statement. Everything seems oke with no error but when i click the button nothing happens:( Here is the code.

Code:

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        Dim i As MsgBoxResult

        For m = 1 To 50

            If TabPage2.Controls("ComboBox" & m).Text = Nothing AndAlso TabPage2.Controls("ComboBox" & m).Enabled = True Or TextBox1.Text = Nothing Then

                i = MsgBox("Fill the empty area in the first page.")

                Exit For

            End If

        Next m

        For m = 51 To 60

            If TabPage3.Controls("ComboBox" & m).Text = Nothing AndAlso TabPage3.Controls("ComboBox" & m).Enabled = True Then

                i = MsgBox("Fill the empty area in the second page.")

                Exit For

            End If

        Next m

        For m = 61 To 70

            If TabPage4.Controls("ComboBox" & m).Text = Nothing AndAlso TabPage4.Controls("ComboBox" & m).Enabled = True Or ComboBox304.Text = Nothing AndAlso ComboBox304.Enabled = True Then

                i = MsgBox("Fill the empty area in the last page.")

                Exit For

            End If

        Next m

        If i = DialogResult.No Then

            Me.TabControl2.Visible = False
            Me.TabControl1.Visible = True

        ElseIf i = DialogResult.Yes Then

            Me.TabControl2.Visible = True
            Me.TabControl1.Visible = False

        End If

    End Sub


Viewing all articles
Browse latest Browse all 15537

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>