📄 login.vb
字号:
Public Class Login
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Login))
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(72, 192)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(112, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(240, 192)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox2.Size = New System.Drawing.Size(120, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'Button1
'
Me.Button1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Button1.Location = New System.Drawing.Point(408, 189)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 7
Me.Button1.Text = "登陆"
'
'Button2
'
Me.Button2.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Button2.Location = New System.Drawing.Point(488, 188)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 8
Me.Button2.Text = "注册"
'
'Login
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
Me.ClientSize = New System.Drawing.Size(600, 253)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MaximumSize = New System.Drawing.Size(608, 280)
Me.MinimumSize = New System.Drawing.Size(608, 280)
Me.Name = "Login"
Me.Text = "用户登陆"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
search.init()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ds As DataSet
ds = search.query("select * from T_User where C_UserId = '" & TextBox1.Text & "' ")
If ds.Tables(0).Rows.Count = 0 Then
MsgBox("没有该用户", vbOKOnly + vbExclamation, "警告")
TextBox1.Text = ""
TextBox2.Text = ""
Else
ds.Clear()
ds = search.query("select * from T_User where C_UserId = '" & TextBox1.Text & "' and C_Password= '" & TextBox2.Text & "' ")
If ds.Tables(0).Rows.Count = 0 Then
MsgBox(" 密码错误-_-!!! " & (Chr(13)) & " 请确认后再输入!")
TextBox2.Text = ""
Else : Dim Man As New Manager
UserInfo.UserName = TextBox1.Text
UserInfo.UserStyle = ds.Tables(0).Rows(0).Item(2)
UserInfo.Log = Me
TextBox1.Text = ""
TextBox2.Text = ""
Me.Hide()
Man.Show()
End If
End If
End Sub
Private Sub Login_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MsgBox("您真的不登录GoodEdu学生信息管理管理系统吗?", _
MsgBoxStyle.YesNo + MsgBoxStyle.Question, "退出登录系统") _
= MsgBoxResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Reg As New Register
Reg.Show()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -