📄 loginform.vb
字号:
Public Class LoginForm
Inherits System.Windows.Forms.Form
Dim My_Login_Var As New Login__Class
Dim My__System__MainForm As New MainForm
Public Member As Integer
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
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
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(LoginForm))
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.Button3 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(97, 247)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(127, 21)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(97, 272)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox2.Size = New System.Drawing.Size(127, 21)
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = ""
'
'Button1
'
Me.Button1.BackColor = System.Drawing.SystemColors.Desktop
Me.Button1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Button1.Location = New System.Drawing.Point(32, 314)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(63, 23)
Me.Button1.TabIndex = 4
Me.Button1.Text = "登陆"
'
'Button2
'
Me.Button2.BackColor = System.Drawing.SystemColors.Desktop
Me.Button2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Button2.Location = New System.Drawing.Point(104, 314)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(52, 23)
Me.Button2.TabIndex = 5
Me.Button2.Text = "注册"
'
'Button3
'
Me.Button3.BackColor = System.Drawing.SystemColors.Desktop
Me.Button3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Button3.Location = New System.Drawing.Point(170, 314)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(55, 23)
Me.Button3.TabIndex = 6
Me.Button3.Text = "取消"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Label1.Location = New System.Drawing.Point(32, 251)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(54, 17)
Me.Label1.TabIndex = 7
Me.Label1.Text = "用户名称"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Label2.Location = New System.Drawing.Point(32, 276)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(54, 17)
Me.Label2.TabIndex = 8
Me.Label2.Text = "用户密码"
'
'LoginForm
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
Me.ClientSize = New System.Drawing.Size(274, 373)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "LoginForm"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "电脑销售系统登陆窗口"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Member = My_Login_Var.Select_MyConnection(TextBox1.Text, TextBox2.Text)
If Member = 0 Then
MsgBox("对不起!非授权用户使用无效", MsgBoxStyle.Information, "提示窗口")
Else
Me.Hide()
My__System__MainForm.Show()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
My_Login_Var.Addnews(TextBox1.Text, TextBox2.Text)
If My_Login_Var.GetState_Add Then
MsgBox("你已经成功的加入一条记录!", MsgBoxStyle.Information, "提示窗口")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
My_Login_Var.EndSub()
End Sub
Private Sub Form1_closeing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim CurrentFormstr As String
If Not e.Cancel Then
CurrentFormstr = "你确实关闭" & Me.Text & "窗口吗?"
End If
If MsgBox(CurrentFormstr, 36, Me.Text) = 7 Then
e.Cancel = True
My__System__MainForm.Close()
My_Login_Var = Nothing
My__System__MainForm = Nothing
MyBase.Close()
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -