Public Class frmLogin
    Dim cnt As Integer
    Dim fd As Integer

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cbotype.SelectedIndexChanged

    End Sub

    Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: 这行代码将数据加载到表“VB.userinformation”中。您可以根据需要移动或删除它。
        Me.UserinformationTableAdapter.Fill(Me.VB.userinformation)
        Cbotype.SelectedIndex = 0
        If userid = "" Then
            cnt = 0
            txtuser.Text = "李浩波"
            txtpwd = ""
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        cnt = cnt + 1
        If cnt = 3 Then
            End
        End If
        If Trim(txtuser.Text) = "" Then
            MsgBox("请输入用户名", vbOKOnly + vbExclamation, "")
    end if
        fd = BindingSource1.Find("username", , Trim(txtuser.Text))
    If fd=-1 then
            MsgBox("没有这个用户", vbOKOnly + vbExclamation, "")
            Exit Sub
        End If
        If Trim(BindingSource1.Current(1).ToString) = Trim(txtpwd.Text) Then

            userid = txtuser.Text
            If Trim(Cbotype.Text) = "管理员" Then
                usertype = 1
            Else
                usertype = 2
            End If
            Me.Dispose()
            Form2.Show()
        Else
            MsgBox("密码不正确", vbOKOnly + vbExclamation, "")
            Exit Sub
        End If
    End Sub

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