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

📄 guest.vb

📁 本人收集到的流水帐软件!小巧实用,希望对大家有说帮助.
💻 VB
字号:
Public Class Guest
    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 TabControl1 As System.Windows.Forms.TabControl
    Friend WithEvents TabPageReg As System.Windows.Forms.TabPage
    Friend WithEvents TabPageDel As System.Windows.Forms.TabPage
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents TextBoxNewName As System.Windows.Forms.TextBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents ButtonOk As System.Windows.Forms.Button
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents ComboBoxNew As System.Windows.Forms.ComboBox
    Friend WithEvents TextBoxPwd2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBoxPwd1 As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.TabControl1 = New System.Windows.Forms.TabControl
        Me.TabPageReg = New System.Windows.Forms.TabPage
        Me.Label4 = New System.Windows.Forms.Label
        Me.TextBoxPwd2 = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.TextBoxPwd1 = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.TextBoxNewName = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.TabPageDel = New System.Windows.Forms.TabPage
        Me.Label7 = New System.Windows.Forms.Label
        Me.TextBox3 = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.ComboBoxNew = New System.Windows.Forms.ComboBox
        Me.Label5 = New System.Windows.Forms.Label
        Me.ButtonOk = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.TabControl1.SuspendLayout()
        Me.TabPageReg.SuspendLayout()
        Me.TabPageDel.SuspendLayout()
        Me.SuspendLayout()
        '
        'TabControl1
        '
        Me.TabControl1.Controls.Add(Me.TabPageReg)
        Me.TabControl1.Controls.Add(Me.TabPageDel)
        Me.TabControl1.Location = New System.Drawing.Point(8, 8)
        Me.TabControl1.Name = "TabControl1"
        Me.TabControl1.SelectedIndex = 0
        Me.TabControl1.Size = New System.Drawing.Size(312, 160)
        Me.TabControl1.TabIndex = 0
        '
        'TabPageReg
        '
        Me.TabPageReg.Controls.Add(Me.Label4)
        Me.TabPageReg.Controls.Add(Me.TextBoxPwd2)
        Me.TabPageReg.Controls.Add(Me.Label3)
        Me.TabPageReg.Controls.Add(Me.TextBoxPwd1)
        Me.TabPageReg.Controls.Add(Me.Label2)
        Me.TabPageReg.Controls.Add(Me.TextBoxNewName)
        Me.TabPageReg.Controls.Add(Me.Label1)
        Me.TabPageReg.Location = New System.Drawing.Point(4, 21)
        Me.TabPageReg.Name = "TabPageReg"
        Me.TabPageReg.Size = New System.Drawing.Size(304, 135)
        Me.TabPageReg.TabIndex = 0
        Me.TabPageReg.Text = "新建用户"
        '
        'Label4
        '
        Me.Label4.ForeColor = System.Drawing.Color.Brown
        Me.Label4.Location = New System.Drawing.Point(48, 112)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(216, 16)
        Me.Label4.TabIndex = 6
        Me.Label4.Text = "说明:用户名、密码为1-14个字符!"
        '
        'TextBoxPwd2
        '
        Me.TextBoxPwd2.Location = New System.Drawing.Point(88, 80)
        Me.TextBoxPwd2.Name = "TextBoxPwd2"
        Me.TextBoxPwd2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.TextBoxPwd2.Size = New System.Drawing.Size(160, 21)
        Me.TextBoxPwd2.TabIndex = 5
        Me.TextBoxPwd2.Text = ""
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(16, 80)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 23)
        Me.Label3.TabIndex = 4
        Me.Label3.Text = "重复密码:"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBoxPwd1
        '
        Me.TextBoxPwd1.Location = New System.Drawing.Point(88, 48)
        Me.TextBoxPwd1.Name = "TextBoxPwd1"
        Me.TextBoxPwd1.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.TextBoxPwd1.Size = New System.Drawing.Size(160, 21)
        Me.TextBoxPwd1.TabIndex = 3
        Me.TextBoxPwd1.Text = ""
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(24, 48)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(64, 23)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "密码:"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBoxNewName
        '
        Me.TextBoxNewName.Location = New System.Drawing.Point(88, 16)
        Me.TextBoxNewName.Name = "TextBoxNewName"
        Me.TextBoxNewName.Size = New System.Drawing.Size(160, 21)
        Me.TextBoxNewName.TabIndex = 1
        Me.TextBoxNewName.Text = ""
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(24, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(64, 23)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "用户名:"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TabPageDel
        '
        Me.TabPageDel.Controls.Add(Me.Label7)
        Me.TabPageDel.Controls.Add(Me.TextBox3)
        Me.TabPageDel.Controls.Add(Me.Label6)
        Me.TabPageDel.Controls.Add(Me.ComboBoxNew)
        Me.TabPageDel.Controls.Add(Me.Label5)
        Me.TabPageDel.Location = New System.Drawing.Point(4, 21)
        Me.TabPageDel.Name = "TabPageDel"
        Me.TabPageDel.Size = New System.Drawing.Size(304, 135)
        Me.TabPageDel.TabIndex = 1
        Me.TabPageDel.Text = "删除用户"
        '
        'Label7
        '
        Me.Label7.ForeColor = System.Drawing.Color.Brown
        Me.Label7.Location = New System.Drawing.Point(48, 88)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(232, 16)
        Me.Label7.TabIndex = 5
        Me.Label7.Text = "说明:选定用户名和密码,点确定删除!"
        '
        'TextBox3
        '
        Me.TextBox3.Location = New System.Drawing.Point(88, 48)
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.TextBox3.Size = New System.Drawing.Size(160, 21)
        Me.TextBox3.TabIndex = 4
        Me.TextBox3.Text = ""
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(24, 48)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(64, 23)
        Me.Label6.TabIndex = 3
        Me.Label6.Text = "密码:"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'ComboBoxNew
        '
        Me.ComboBoxNew.Location = New System.Drawing.Point(88, 16)
        Me.ComboBoxNew.Name = "ComboBoxNew"
        Me.ComboBoxNew.Size = New System.Drawing.Size(160, 20)
        Me.ComboBoxNew.TabIndex = 2
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(24, 16)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(64, 23)
        Me.Label5.TabIndex = 1
        Me.Label5.Text = "用户名:"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'ButtonOk
        '
        Me.ButtonOk.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.ButtonOk.Location = New System.Drawing.Point(144, 176)
        Me.ButtonOk.Name = "ButtonOk"
        Me.ButtonOk.Size = New System.Drawing.Size(70, 23)
        Me.ButtonOk.TabIndex = 6
        Me.ButtonOk.Text = "确定(&O)"
        '
        'Button2
        '
        Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.Button2.Location = New System.Drawing.Point(232, 176)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(70, 23)
        Me.Button2.TabIndex = 7
        Me.Button2.Text = "取消(&C)"
        '
        'Guest
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(328, 206)
        Me.ControlBox = False
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.TabControl1)
        Me.Controls.Add(Me.ButtonOk)
        Me.MinimumSize = New System.Drawing.Size(300, 199)
        Me.Name = "Guest"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "小鱼流水帐 V1.0—用户"
        Me.TabControl1.ResumeLayout(False)
        Me.TabPageReg.ResumeLayout(False)
        Me.TabPageDel.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Guest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


    End Sub

    Private Sub Guest_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        '快捷键盘Alt+O登陆
        If e.Alt = True And e.KeyCode = Keys.O Then
            ButtonOk.PerformClick()
        End If
        '快捷键盘Alt+C清楚
        If e.Alt = True And e.KeyCode = Keys.C Then
            Button2.PerformClick()
        End If
    End Sub


    Dim S As New S_AdminInfo
    '增加一个新用户
    Private Sub ButtonOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOk.Click
        If Me.TabControl1.SelectedTab.Text = "新建用户" Then
            Dim S As New S_AdminInfo
            If Me.TextBoxNewName.Text = Nothing Or Me.TextBoxPwd1.Text = Nothing Then
                MsgBox("请输入用户名或密码!", MsgBoxStyle.Exclamation)
            ElseIf Me.TextBoxPwd1.Text <> Me.TextBoxPwd2.Text Then
                MsgBox("两次输入的密码不一致!", MsgBoxStyle.Exclamation)
            Else
                S.LoginPwd = Me.TextBoxPwd1.Text
                S.LoginName = Me.TextBoxNewName.Text
                With New D_AdminInfo
                    .AddGuest(S, ErrStr)
                    Me.Close()
                End With
            End If
        End If
        If Me.TabControl1.SelectedTab.Text = "删除用户" Then
            If Me.ComboBoxNew.Text = Nothing Or Me.TextBox3.Text = Nothing Then
                MsgBox("请选择用户名或输入密码!", MsgBoxStyle.Exclamation)
            Else
                Dim Stemp As New S_AdminInfo
                S.LoginName = Trim(Me.ComboBoxNew.Text)
                With New D_AdminInfo
                    Stemp = .LoginCheck(S, ErrStr)
                    If Stemp Is Nothing Then
                        MsgBox("数据读取失败!", MsgBoxStyle.Exclamation)
                    ElseIf Stemp.LoginPwd <> Me.TextBox3.Text Then
                        MsgBox("密码输入错误!", MsgBoxStyle.Exclamation)
                    Else
                        .DelGuest(S, ErrStr)
                        MsgBox("用户删除成功!", MsgBoxStyle.Exclamation)
                        Me.Close()
                    End If
                End With
            End If
        End If

    End Sub

    '关闭窗体返回登陆
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    '下拉菜单
    Private Sub ComboBoxNew_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBoxNew.MouseEnter
        Dim Stemp As New DataSet
        Dim i As Integer
        With New D_AdminInfo
            Stemp = .SelectGuest(ErrStr)
            Me.ComboBoxNew.Items.Clear()
            For i = 0 To Stemp.Tables(0).Rows.Count - 1
                Me.ComboBoxNew.Items.Add(Stemp.Tables(0).Rows(i)("LoginName"))
            Next
        End With
    End Sub
End Class

⌨️ 快捷键说明

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