且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

循环遍历空文本框,直到文本框有数据

更新时间:2023-11-03 09:20:46

我将我的评估条件移动到点击事件的执行按钮上.在那里我运行一个 if 语句,当 hasData 为真时,运行该函数和其余代码.

I moved my evaluating condition to the execute buttons on click event. There I run an if statement and when hasData is true run the function with the rest of the code.

    Private Sub btnExecute_Click(sender As Object, e As EventArgs) Handles btnExecute.Click
    Dim hasData As Boolean = False
    If txtTechManName.Text.Trim = "" Or txtDirectory.Text.Trim = "" Or txtBxUnique.Text.Trim = "" Then
        hasData = False
        MsgBox(" Please fill all text boxes on form ")

        If txtTechManName.Text.Trim = "" Then
            txtTechManName.Focus()
        ElseIf txtDirectory.Text.Trim = "" Then
            txtDirectory.Focus()
        ElseIf txtBxUnique.Text.Trim = "" Then
            txtBxUnique.Focus()
        End If
    Else
        hasData = True
        runProgram()
    End If
End Sub