loginerror.vb

来自「系统概要: 本系统采用VB.NET开发. 开发平台:Windows XP P」· VB 代码 · 共 293 行

VB
293
字号
Public Class LoginError
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    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

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    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 rbReGetPaper As System.Windows.Forms.RadioButton
    Friend WithEvents rbContinue As System.Windows.Forms.RadioButton
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents tbName As System.Windows.Forms.TextBox
    Friend WithEvents tbPassword As System.Windows.Forms.TextBox
    Friend WithEvents tbSID As System.Windows.Forms.TextBox
    Friend WithEvents lbSName As System.Windows.Forms.Label
    Friend WithEvents tbSName As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(LoginError))
        Me.btnOK = New System.Windows.Forms.Button
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.tbName = New System.Windows.Forms.TextBox
        Me.tbPassword = New System.Windows.Forms.TextBox
        Me.tbSID = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.rbReGetPaper = New System.Windows.Forms.RadioButton
        Me.rbContinue = New System.Windows.Forms.RadioButton
        Me.lbSName = New System.Windows.Forms.Label
        Me.tbSName = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        '
        'btnOK
        '
        Me.btnOK.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnOK.Location = New System.Drawing.Point(163, 207)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.Size = New System.Drawing.Size(90, 25)
        Me.btnOK.TabIndex = 0
        Me.btnOK.Text = "确 定"
        '
        'Label1
        '
        Me.Label1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Label1.Location = New System.Drawing.Point(77, 26)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(67, 25)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "监 考 员:"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'Label2
        '
        Me.Label2.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Label2.Location = New System.Drawing.Point(77, 60)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(67, 25)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "密    码:"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'tbName
        '
        Me.tbName.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbName.Location = New System.Drawing.Point(154, 26)
        Me.tbName.Name = "tbName"
        Me.tbName.Size = New System.Drawing.Size(192, 21)
        Me.tbName.TabIndex = 3
        Me.tbName.Text = ""
        '
        'tbPassword
        '
        Me.tbPassword.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbPassword.Location = New System.Drawing.Point(154, 60)
        Me.tbPassword.Name = "tbPassword"
        Me.tbPassword.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.tbPassword.Size = New System.Drawing.Size(192, 21)
        Me.tbPassword.TabIndex = 4
        Me.tbPassword.Text = ""
        '
        'tbSID
        '
        Me.tbSID.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbSID.Location = New System.Drawing.Point(154, 95)
        Me.tbSID.Name = "tbSID"
        Me.tbSID.Size = New System.Drawing.Size(192, 21)
        Me.tbSID.TabIndex = 5
        Me.tbSID.Text = ""
        '
        'Label3
        '
        Me.Label3.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Label3.Location = New System.Drawing.Point(77, 95)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(67, 25)
        Me.Label3.TabIndex = 6
        Me.Label3.Text = "考   号:"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'rbReGetPaper
        '
        Me.rbReGetPaper.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.rbReGetPaper.Checked = True
        Me.rbReGetPaper.Location = New System.Drawing.Point(96, 164)
        Me.rbReGetPaper.Name = "rbReGetPaper"
        Me.rbReGetPaper.Size = New System.Drawing.Size(125, 26)
        Me.rbReGetPaper.TabIndex = 7
        Me.rbReGetPaper.TabStop = True
        Me.rbReGetPaper.Text = "重新抽题"
        '
        'rbContinue
        '
        Me.rbContinue.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.rbContinue.Location = New System.Drawing.Point(221, 164)
        Me.rbContinue.Name = "rbContinue"
        Me.rbContinue.Size = New System.Drawing.Size(125, 26)
        Me.rbContinue.TabIndex = 8
        Me.rbContinue.Text = "继续考试"
        '
        'lbSName
        '
        Me.lbSName.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.lbSName.Location = New System.Drawing.Point(77, 129)
        Me.lbSName.Name = "lbSName"
        Me.lbSName.Size = New System.Drawing.Size(77, 25)
        Me.lbSName.TabIndex = 9
        Me.lbSName.Text = "考生姓名:"
        Me.lbSName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'tbSName
        '
        Me.tbSName.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbSName.Location = New System.Drawing.Point(154, 129)
        Me.tbSName.Name = "tbSName"
        Me.tbSName.Size = New System.Drawing.Size(192, 21)
        Me.tbSName.TabIndex = 10
        Me.tbSName.Text = ""
        '
        'LoginError
        '
        Me.AcceptButton = Me.btnOK
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(426, 252)
        Me.Controls.Add(Me.tbSName)
        Me.Controls.Add(Me.lbSName)
        Me.Controls.Add(Me.rbContinue)
        Me.Controls.Add(Me.rbReGetPaper)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.tbSID)
        Me.Controls.Add(Me.tbPassword)
        Me.Controls.Add(Me.tbName)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.btnOK)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "LoginError"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "监考员验证"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public SID As String                '考号
    Public SName As String              '姓名
    Public STeam As String              '班级
    Public IsLate As Boolean = False    '是否迟到
    Public IsExamed As Boolean = False  '是否已经考试

    '页面加载事件
    Private Sub LoginError_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.tbSID.Text = SID
        Me.tbSName.Text = SName
        If IsLate Then
            Me.rbContinue.Visible = False
            Me.rbReGetPaper.Visible = False
        End If

    End Sub

    '确定点击事件
    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click

        '验证监考员信息
        Dim oExam As New AutoCAD.Exam
        If Not oExam.ValidateMonitor(Me.tbName.Text, Me.tbPassword.Text) Then
            MessageBox.Show("用户名或密码错误", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Return
        End If

        '如果是考试迟到
        If IsLate Then
            '点击确定,开始抽取试题
            If Common.GetPaper(Me.SID) Then
                '抽题成功,打开考试窗体
                Dim frmExam As New Exam
                frmExam.SID = SID
                frmExam.SName = SName
                frmExam.STeam = STeam
                frmExam.Show()
                Me.Hide()
                Return
            Else
                MessageBox.Show("抽题出错!请稍息再试!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
        End If

        '如要是重新考试
        If IsExamed Then
            If Me.rbContinue.Checked Then
                '继续考试
                Dim frmExam As New Exam
                frmExam.SID = SID
                frmExam.SName = SName
                frmExam.STeam = STeam
                frmExam.Show()
                Me.Hide()
                Return
            ElseIf Me.rbReGetPaper.Checked Then
                '重新抽题
                If Common.GetPaper(SID) Then
                    '抽题成功,打开考试窗体
                    Dim frmExam As New Exam
                    frmExam.SID = SID
                    frmExam.SName = SName
                    frmExam.STeam = STeam
                    frmExam.Show()
                    Me.Hide()
                    Return
                Else
                    MessageBox.Show("抽题出错!请稍息再试!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Return
                End If
            End If
        End If

    End Sub

End Class

⌨️ 快捷键说明

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