⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.vb

📁 用VB.NET写的人员管理系统,可用于二次开发.
💻 VB
字号:
Public Class Login
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化
        Dim MyResult As Short
        MyResult = OpenDb()

    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 Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents TxtName As System.Windows.Forms.TextBox
    Friend WithEvents TxtPassword As System.Windows.Forms.TextBox
    Friend WithEvents BtLogin As System.Windows.Forms.Button
    Friend WithEvents BtCancel As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.TxtName = New System.Windows.Forms.TextBox
        Me.TxtPassword = New System.Windows.Forms.TextBox
        Me.BtLogin = New System.Windows.Forms.Button
        Me.BtCancel = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("幼圆", 21.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label1.ForeColor = System.Drawing.SystemColors.Desktop
        Me.Label1.Location = New System.Drawing.Point(40, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(208, 32)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "人员管理系统"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(16, 88)
        Me.Label2.Name = "Label2"
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "用户名:"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(16, 136)
        Me.Label3.Name = "Label3"
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "密码:"
        '
        'TxtName
        '
        Me.TxtName.Location = New System.Drawing.Point(128, 88)
        Me.TxtName.Name = "TxtName"
        Me.TxtName.TabIndex = 3
        Me.TxtName.Text = " "
        '
        'TxtPassword
        '
        Me.TxtPassword.Location = New System.Drawing.Point(128, 136)
        Me.TxtPassword.Name = "TxtPassword"
        Me.TxtPassword.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.TxtPassword.TabIndex = 4
        Me.TxtPassword.Text = " "
        '
        'BtLogin
        '
        Me.BtLogin.Location = New System.Drawing.Point(32, 192)
        Me.BtLogin.Name = "BtLogin"
        Me.BtLogin.TabIndex = 5
        Me.BtLogin.Text = "登录"
        '
        'BtCancel
        '
        Me.BtCancel.Location = New System.Drawing.Point(136, 192)
        Me.BtCancel.Name = "BtCancel"
        Me.BtCancel.TabIndex = 6
        Me.BtCancel.Text = "取消"
        '
        'Login
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Controls.Add(Me.BtCancel)
        Me.Controls.Add(Me.BtLogin)
        Me.Controls.Add(Me.TxtPassword)
        Me.Controls.Add(Me.TxtName)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "Login"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "登录系统"
        Me.ResumeLayout(False)

    End Sub

#End Region
    
    Private Sub BtLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtLogin.Click
        Dim Mysql As String
        Mysql = "select * from tbManager where Name='" & TxtName.Text & "' AND Pwd='" & TxtPassword.Text & "'"
        Myrec = Mydb.OpenRecordset(Mysql, DAO.RecordsetTypeEnum.dbOpenDynaset)
        If Myrec.EOF = True Then
            MsgBox("输入用户名或密码错误!", MsgBoxStyle.Exclamation, Me.Text)
            Exit Sub
        End If
        ManagerName = Trim(TxtName.Text)
        Password = Trim(TxtPassword.Text)
        Dim Frmobj As New main
        Frmobj.Show()
        Me.Finalize()
    End Sub

    Private Sub BtCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtCancel.Click
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -