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

📄 登录.vb

📁 这是个用VB编写的机票销售与查询管理系统
💻 VB
字号:
Imports System.Data
Imports System.Data.SqlClient
Public Class 登录
    Inherits System.Windows.Forms.Form
    Dim count As Integer = 0
    Dim my_class As New class1

#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 Button2 As System.Windows.Forms.Button
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(登录))
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button1 = New System.Windows.Forms.Button
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.SuspendLayout()
        '
        'Button2
        '
        Me.Button2.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Button2.Location = New System.Drawing.Point(288, 299)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(112, 32)
        Me.Button2.TabIndex = 13
        Me.Button2.Text = "取  消"
        '
        'Button1
        '
        Me.Button1.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Button1.Location = New System.Drawing.Point(96, 299)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(112, 32)
        Me.Button1.TabIndex = 12
        Me.Button1.Text = "确  定"
        '
        'TextBox2
        '
        Me.TextBox2.AutoSize = False
        Me.TextBox2.Location = New System.Drawing.Point(208, 235)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.TextBox2.Size = New System.Drawing.Size(240, 32)
        Me.TextBox2.TabIndex = 11
        Me.TextBox2.Text = ""
        '
        'TextBox1
        '
        Me.TextBox1.AutoSize = False
        Me.TextBox1.Location = New System.Drawing.Point(208, 163)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(240, 32)
        Me.TextBox1.TabIndex = 10
        Me.TextBox1.Text = ""
        '
        'Label3
        '
        Me.Label3.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label3.Location = New System.Drawing.Point(48, 243)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(136, 32)
        Me.Label3.TabIndex = 9
        Me.Label3.Text = "   密    码"
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label2.Location = New System.Drawing.Point(48, 171)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(136, 32)
        Me.Label2.TabIndex = 8
        Me.Label2.Text = "   用 户 名"
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("华文彩云", 36.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label1.ForeColor = System.Drawing.SystemColors.InactiveCaption
        Me.Label1.Location = New System.Drawing.Point(88, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(328, 120)
        Me.Label1.TabIndex = 7
        Me.Label1.Text = "山东航空公司             管理信息系统"
        '
        '登录
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(504, 390)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "登录"
        Me.Text = "Form7"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim user As String
        Dim pw As String
        Dim frm As New MDIForm1
        Dim temp1 As String
        Dim temp2 As String
        Dim con As String
        Dim singe As Integer = 1
        user = TextBox1.Text
        username = TextBox1.Text
        pw = TextBox2.Text
        con = "select * from users where id='" + user + "' and password='" + pw + "'"
        Dim ds As New DataSet
        ds = my_class.query(con)
        Try
            If ds.Tables(0).Rows.Count > 0 Then
                my_class.dr = ds.Tables(0).Rows(0)
                temp1 = my_class.dr(0)
                temp2 = my_class.dr(1)
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        con = "insert into log(id) select id from permission where id='" + temp1 + "'"
        If (Trim(user) = Trim(temp1) And Trim(pw) = Trim(temp2) And (user <> "" Or pw <> "")) Then
            Me.Hide()
            my_class.insert(con)
            frm.Show()
            singe = 1
        ElseIf (user = "" And pw = "") Then
            MessageBox.Show("用户名和密码为空!", "提示")
            TextBox1.Focus()
            singe = 0
        ElseIf (Trim(user) <> Trim(temp1) Or Trim(pw) <> Trim(temp2)) Then
            MessageBox.Show("没有这个用户或密码错误,请重新输入!", "提示")
            TextBox1.SelectAll()
            TextBox1.Focus()
            singe = 0
        End If
        count = count + 1
        If (count = 3 And singe = 0) Then
            MessageBox.Show("三次错误,退出本系统", "提示")
            End
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub

    Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        my_class.init()
        Label1.BackColor = Color.Transparent
        Label2.BackColor = Color.Transparent
        Label3.BackColor = Color.Transparent
        Button1.BackColor = Color.Transparent
        Button2.BackColor = Color.Transparent
    End Sub
End Class

⌨️ 快捷键说明

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