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

📄 frmpassword.vb

📁 酒店管理系统,可以用户与酒店的管理,客房登记、结帐、预定
💻 VB
字号:
Imports System.Data.SqlClient
Public Class frmpassword
    Inherits System.Windows.Forms.Form
    Dim blnclose As Boolean
    Dim struserid As String

#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 Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents btnok As System.Windows.Forms.Button
    Friend WithEvents btncancle As System.Windows.Forms.Button
    Friend WithEvents txtuserid As System.Windows.Forms.TextBox
    Friend WithEvents txtpassword As System.Windows.Forms.TextBox
    Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
    Friend WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand
    Friend WithEvents SqlCommand2 As System.Data.SqlClient.SqlCommand
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmpassword))
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.txtuserid = New System.Windows.Forms.TextBox
        Me.txtpassword = New System.Windows.Forms.TextBox
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.btnok = New System.Windows.Forms.Button
        Me.btncancle = New System.Windows.Forms.Button
        Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
        Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand
        Me.SqlCommand2 = New System.Data.SqlClient.SqlCommand
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label1.Location = New System.Drawing.Point(80, 40)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(64, 23)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "用户名:"
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label2.Location = New System.Drawing.Point(80, 104)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(56, 23)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "密 码:"
        '
        'txtuserid
        '
        Me.txtuserid.Location = New System.Drawing.Point(144, 40)
        Me.txtuserid.Name = "txtuserid"
        Me.txtuserid.Size = New System.Drawing.Size(112, 21)
        Me.txtuserid.TabIndex = 2
        Me.txtuserid.Text = ""
        '
        'txtpassword
        '
        Me.txtpassword.Location = New System.Drawing.Point(144, 104)
        Me.txtpassword.Name = "txtpassword"
        Me.txtpassword.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.txtpassword.Size = New System.Drawing.Size(112, 21)
        Me.txtpassword.TabIndex = 3
        Me.txtpassword.Text = ""
        '
        'PictureBox1
        '
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(8, 8)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(64, 128)
        Me.PictureBox1.TabIndex = 4
        Me.PictureBox1.TabStop = False
        '
        'btnok
        '
        Me.btnok.Location = New System.Drawing.Point(96, 144)
        Me.btnok.Name = "btnok"
        Me.btnok.Size = New System.Drawing.Size(56, 23)
        Me.btnok.TabIndex = 5
        Me.btnok.Text = "确定"
        '
        'btncancle
        '
        Me.btncancle.Location = New System.Drawing.Point(176, 144)
        Me.btncancle.Name = "btncancle"
        Me.btncancle.Size = New System.Drawing.Size(56, 23)
        Me.btncancle.TabIndex = 6
        Me.btncancle.Text = "取消"
        '
        'SqlConnection1
        '
        Me.SqlConnection1.ConnectionString = "workstation id=4D3A93FBF8BE4E6;packet size=4096;user id=sa;data source=4D3A93FBF8" & _
        "BE4E6;persist security info=False;initial catalog=sqlqtgl"
        '
        'SqlCommand1
        '
        Me.SqlCommand1.Connection = Me.SqlConnection1
        '
        'frmpassword
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(360, 198)
        Me.Controls.Add(Me.btncancle)
        Me.Controls.Add(Me.btnok)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.txtpassword)
        Me.Controls.Add(Me.txtuserid)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "frmpassword"
        Me.Text = "用户登录"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Public Property MyUser() As String
        Get
            MyUser = struserid
        End Get
        Set(ByVal Value As String)
            struserid = Value
        End Set
    End Property

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        blnclose = True
    End Sub

    Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        e.Cancel = Not blnclose
    End Sub

    Private Sub btnok_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnok.Click
        SqlCommand1.CommandText = "select 用户名 from 用户 where 用户名='" & txtuserid.Text & "'and 密码='" & txtpassword.Text & "'"
        SqlConnection1.Open()
        struserid = CType(SqlCommand1.ExecuteScalar(), String)
        If struserid = "" Then
            MessageBox.Show("用户名或密码错误!", "身份人证失败", MessageBoxButtons.OK, MessageBoxIcon.Error)
            blnclose = False
        Else
            blnclose = True
            struserid = txtuserid.Text
          
        End If
        SqlConnection1.Close()


    End Sub

    Private Sub btncancle_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancle.Click
        MyUser = ""
        blnclose = True
        Me.Close()

    End Sub
End Class

⌨️ 快捷键说明

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