要求:有 2个窗口:登录(FornLogin),主界面(FornMain),系统启动时先出现 FormLogin,用户名和密码正确后启动主界面,并关闭 FormLogin
实现:1)设置 My Project :设置启动窗体为 FormLogin,关机模式为最后1个窗体关闭时;
2)FormLogin 的登录按钮的代码
Private Sub ButtonLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLogin.Click
Dim id , Pw , Rt_Val As String
Dim Querys As New Query_Main
...........................................................
.............................................................
Rt_Val = Querys.Check_Login(id, Pw) ’== 判定 ID和密码是否正确
IF Rt_Val = "0" Then
Me.Hide()
FormMain.Show()
Me.Close()
End If
End Sub