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

📄 frmtestinfo.vb

📁 这个是本人写的题库系统,开发工具是vb.net.试题编辑,试卷编辑,可以在word中编辑试题.由于时间关系,很多功能需要细化.
💻 VB
字号:
Public Class frmtestInfo
    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 GroupBox3 As System.Windows.Forms.GroupBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents txt_totalscore As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents comb_testtype As System.Windows.Forms.ComboBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents comb_testmoth As System.Windows.Forms.ComboBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents txt_teacher As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents lbl_date As System.Windows.Forms.Label
    Friend WithEvents cmd_ok As System.Windows.Forms.Button
    Friend WithEvents cmd_cancel As System.Windows.Forms.Button
    Friend WithEvents txt_testtitle As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.GroupBox3 = New System.Windows.Forms.GroupBox
        Me.lbl_date = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.txt_totalscore = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.comb_testtype = New System.Windows.Forms.ComboBox
        Me.Label5 = New System.Windows.Forms.Label
        Me.comb_testmoth = New System.Windows.Forms.ComboBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.txt_teacher = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.txt_testtitle = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.cmd_ok = New System.Windows.Forms.Button
        Me.cmd_cancel = New System.Windows.Forms.Button
        Me.GroupBox3.SuspendLayout()
        Me.SuspendLayout()
        '
        'GroupBox3
        '
        Me.GroupBox3.Controls.Add(Me.lbl_date)
        Me.GroupBox3.Controls.Add(Me.Label7)
        Me.GroupBox3.Controls.Add(Me.txt_totalscore)
        Me.GroupBox3.Controls.Add(Me.Label6)
        Me.GroupBox3.Controls.Add(Me.comb_testtype)
        Me.GroupBox3.Controls.Add(Me.Label5)
        Me.GroupBox3.Controls.Add(Me.comb_testmoth)
        Me.GroupBox3.Controls.Add(Me.Label4)
        Me.GroupBox3.Controls.Add(Me.txt_teacher)
        Me.GroupBox3.Controls.Add(Me.Label3)
        Me.GroupBox3.Controls.Add(Me.txt_testtitle)
        Me.GroupBox3.Controls.Add(Me.Label2)
        Me.GroupBox3.Dock = System.Windows.Forms.DockStyle.Top
        Me.GroupBox3.Location = New System.Drawing.Point(0, 0)
        Me.GroupBox3.Name = "GroupBox3"
        Me.GroupBox3.Size = New System.Drawing.Size(466, 128)
        Me.GroupBox3.TabIndex = 1
        Me.GroupBox3.TabStop = False
        Me.GroupBox3.Text = "试卷信息"
        '
        'lbl_date
        '
        Me.lbl_date.Location = New System.Drawing.Point(88, 96)
        Me.lbl_date.Name = "lbl_date"
        Me.lbl_date.Size = New System.Drawing.Size(88, 16)
        Me.lbl_date.TabIndex = 11
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(7, 96)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(72, 16)
        Me.Label7.TabIndex = 10
        Me.Label7.Text = "出卷时间:"
        '
        'txt_totalscore
        '
        Me.txt_totalscore.Location = New System.Drawing.Point(400, 54)
        Me.txt_totalscore.MaxLength = 20
        Me.txt_totalscore.Name = "txt_totalscore"
        Me.txt_totalscore.Size = New System.Drawing.Size(56, 21)
        Me.txt_totalscore.TabIndex = 9
        Me.txt_totalscore.Text = ""
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(352, 56)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(48, 16)
        Me.Label6.TabIndex = 8
        Me.Label6.Text = "总分:"
        '
        'comb_testtype
        '
        Me.comb_testtype.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.comb_testtype.Items.AddRange(New Object() {"A卷", "B卷", "C卷", "D卷", "E卷", "F卷"})
        Me.comb_testtype.Location = New System.Drawing.Point(248, 54)
        Me.comb_testtype.Name = "comb_testtype"
        Me.comb_testtype.Size = New System.Drawing.Size(96, 20)
        Me.comb_testtype.TabIndex = 7
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(184, 56)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(72, 16)
        Me.Label5.TabIndex = 6
        Me.Label5.Text = "试卷类型:"
        '
        'comb_testmoth
        '
        Me.comb_testmoth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.comb_testmoth.Items.AddRange(New Object() {"闭卷", "开卷"})
        Me.comb_testmoth.Location = New System.Drawing.Point(80, 54)
        Me.comb_testmoth.Name = "comb_testmoth"
        Me.comb_testmoth.Size = New System.Drawing.Size(96, 20)
        Me.comb_testmoth.TabIndex = 5
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(8, 56)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(72, 16)
        Me.Label4.TabIndex = 4
        Me.Label4.Text = "考试方式:"
        '
        'txt_teacher
        '
        Me.txt_teacher.Location = New System.Drawing.Point(352, 16)
        Me.txt_teacher.MaxLength = 20
        Me.txt_teacher.Name = "txt_teacher"
        Me.txt_teacher.Size = New System.Drawing.Size(104, 21)
        Me.txt_teacher.TabIndex = 3
        Me.txt_teacher.Text = ""
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(296, 19)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(56, 15)
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "出卷人:"
        '
        'txt_testtitle
        '
        Me.txt_testtitle.Location = New System.Drawing.Point(56, 17)
        Me.txt_testtitle.MaxLength = 30
        Me.txt_testtitle.Name = "txt_testtitle"
        Me.txt_testtitle.Size = New System.Drawing.Size(232, 21)
        Me.txt_testtitle.TabIndex = 1
        Me.txt_testtitle.Text = ""
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(8, 21)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(48, 16)
        Me.Label2.TabIndex = 0
        Me.Label2.Text = "标题:"
        '
        'cmd_ok
        '
        Me.cmd_ok.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.cmd_ok.Location = New System.Drawing.Point(128, 144)
        Me.cmd_ok.Name = "cmd_ok"
        Me.cmd_ok.Size = New System.Drawing.Size(72, 30)
        Me.cmd_ok.TabIndex = 16
        Me.cmd_ok.Text = "确   定"
        '
        'cmd_cancel
        '
        Me.cmd_cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.cmd_cancel.Location = New System.Drawing.Point(272, 144)
        Me.cmd_cancel.Name = "cmd_cancel"
        Me.cmd_cancel.Size = New System.Drawing.Size(72, 30)
        Me.cmd_cancel.TabIndex = 17
        Me.cmd_cancel.Text = "取   消"
        '
        'frmtestInfo
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(466, 191)
        Me.Controls.Add(Me.cmd_cancel)
        Me.Controls.Add(Me.cmd_ok)
        Me.Controls.Add(Me.GroupBox3)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.MaximizeBox = False
        Me.Name = "frmtestInfo"
        Me.Text = "试卷信息"
        Me.GroupBox3.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub cmd_ok_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmd_ok.MouseLeave, _
                   cmd_cancel.MouseLeave 
        sender.backcolor = System.Drawing.SystemColors.Control
    End Sub

    Private Sub cmd_ok_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cmd_ok.MouseMove, _
                cmd_cancel.MouseMove
        sender.backcolor = System.Drawing.SystemColors.ControlLight
    End Sub
    Public Function OpenOnce(ByVal frm As Form, ByVal parentfrm As Form) As Boolean
        Dim mdifrm As Form
        For Each mdifrm In parentfrm.MdiChildren
            If frm.Text = mdifrm.Text Then
                mdifrm.Activate()
                Return False
                Exit Function
            End If
        Next
        Return True
    End Function
    Private Sub cmd_ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_ok.Click
        If OpSubjt.SubjectID <= 0 Then
            MsgBox("请您选择当前操作科目", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
            CheckSelSub = False
            ProductTest = False
            Me.Close()
        End If
        If Trim(txt_testtitle.Text) = "" Then
            MsgBox("试卷标题不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
            txt_testtitle.Focus()
            Exit Sub
        End If
        If Trim(txt_teacher.Text) = "" Then
            MsgBox("出卷人不能为空不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
            txt_teacher.Focus()
            Exit Sub
        End If
        If Trim(txt_totalscore.Text) = "" Then
            If MsgBox("总分为空,您是否选择默认值100", MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0") = MsgBoxResult.No Then
                txt_testtitle.Focus()
                Exit Sub
            End If
        End If
        MyTest.TestID = MyTest.GetNewID()
        MyTest.TestMoth = Trim(comb_testmoth.Text)
        MyTest.TestTitle = MakeStr(txt_testtitle.Text)
        MyTest.TestType = Trim(comb_testtype.Text)
        MyTest.TestOpName = Trim(txt_teacher.Text)
        MyTest.TestOpTime = Trim(lbl_date.Text)
        MyTest.TestScore = Int(txt_totalscore.Text)
        'MyTest.TestContext = ""
        ' MyTest.TestResult = ""
        MyTest.SubjectID = OpSubjt.SubjectID
        If MyTest.InsertDB() Then
            CurTest.Equal(MyTest)
            ProductTest = True
        Else
            MyTest.Initials()
            CurTest.Initials()
            ProductTest = False
        End If
        Dim fmprodbyman As New frmprodbyman
        If OpenOnce(fmprodbyman, Me.ParentForm) Then
            fmprodbyman.MdiParent = Me.ParentForm
            fmprodbyman.Show()
        End If
        Me.Close()
    End Sub

    Private Sub frmtestInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txt_totalscore.Text = Trim(Str(100))
        lbl_date.Text = Today().ToString
        ProductTest = False
        comb_testmoth.SelectedIndex = 0
        comb_testtype.SelectedIndex = 0
    End Sub

    Private Sub cmd_cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_cancel.Click
        MyTest.Initials()
        CurTest.Initials()
        ProductTest = False
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

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