FormName.Show () 在 VS 2019 中不起作用
FormName.Show () is not working in VS 2019
每当我试图通过 switching/proceeding 将 window 关闭到另一种形式时,它不会按照代码显示 window。没有错误,我也试过使用 Build 但没有用。
这是它出现的地方:
Public Class LoginForm
Private Sub BtnLogin_Click(sender As Object, e As EventArgs) Handles BtnLogin.Click
If (IsFormValid()) Then
qr = "Select * from UserLogin where UserName='" & UsernameText.Text & "' And Password ='" & PasswordText.Text & "'"
ds = SearchData(qr)
If (ds.Tables(0).Rows.Count > 0) Then
DashboardForm.Show() ' ***Problem is here***
Me.Close()
Else
MsgBox("Username and Passowrd is not correct", MsgBoxStyle.Critical)
End If
End If
End Sub
Private Function IsFormValid() As Boolean
If (UsernameText.Text.Trim() = String.Empty) Then
MsgBox("Username is required", MsgBoxStyle.Critical)
UsernameText.Clear()
PasswordText.Clear()
Return False
End If
If (PasswordText.Text.Trim() = String.Empty) Then
MsgBox("Password is required", MsgBoxStyle.Critical)
UsernameText.Clear()
PasswordText.Clear()
Return False
End If
Return True
End Function
End Class
DashboardForm 是用户登录后继续操作的地方。问题是当我正确输入用户名和密码时,登录表单自行关闭,表明调试已完成,没有表单之后出现。
我尝试删除 Me.Close(),它现在可以正常工作,但登录表单仍然存在。
在项目属性中
在“应用程序”选项卡上,确保关闭模式为“当最后一个表单关闭时”
每当我试图通过 switching/proceeding 将 window 关闭到另一种形式时,它不会按照代码显示 window。没有错误,我也试过使用 Build 但没有用。
这是它出现的地方:
Public Class LoginForm
Private Sub BtnLogin_Click(sender As Object, e As EventArgs) Handles BtnLogin.Click
If (IsFormValid()) Then
qr = "Select * from UserLogin where UserName='" & UsernameText.Text & "' And Password ='" & PasswordText.Text & "'"
ds = SearchData(qr)
If (ds.Tables(0).Rows.Count > 0) Then
DashboardForm.Show() ' ***Problem is here***
Me.Close()
Else
MsgBox("Username and Passowrd is not correct", MsgBoxStyle.Critical)
End If
End If
End Sub
Private Function IsFormValid() As Boolean
If (UsernameText.Text.Trim() = String.Empty) Then
MsgBox("Username is required", MsgBoxStyle.Critical)
UsernameText.Clear()
PasswordText.Clear()
Return False
End If
If (PasswordText.Text.Trim() = String.Empty) Then
MsgBox("Password is required", MsgBoxStyle.Critical)
UsernameText.Clear()
PasswordText.Clear()
Return False
End If
Return True
End Function
End Class
DashboardForm 是用户登录后继续操作的地方。问题是当我正确输入用户名和密码时,登录表单自行关闭,表明调试已完成,没有表单之后出现。
我尝试删除 Me.Close(),它现在可以正常工作,但登录表单仍然存在。
在项目属性中