当前位置:跳过导航链接计算机毕业设计首页 : VB计算机毕业设计 : 详细内容

VB试题库在线考试系统(程序下载)(5)

来源:xiaoniu168.com 作者:本站原创 添加时间:2014-11-08 点击数:30130

计算机毕业设计介绍:

4.1 系统主界面
用户登陆系统以后,显示系统的主界面。包括菜单栏和快捷按钮栏。

4.2 试题维护管理
(1)单选题
此模块可以添加、修改和删除单选题内容信息。包括题目内容、答案A、答案B、答案C、答案D、正确答案。
计算机毕业论文

以下是引用片段:

其关键代码实现如下:
Public Sub UpdateList()
'设置表格的标头和样式
'动态从数据库中装载数据
'1
Dim arrName()
    arrName = Array("编号", "题目内容", "答案A", "答案B", "答案C", "答案D", "正确答案")
Dim arrColwidth()
    arrColwidth = Array(0, ddd.Width / 6, ddd.Width / 6, ddd.Width / 6, ddd.Width / 6, ddd.Width / 6, ddd.Width / 6 - 300)
ddd.Cols = 7
ddd.Rows = 2
Dim i As Long
For i = 0 To ddd.Cols - 1
    ddd.ColWidth(i) = arrColwidth(i)
    ddd.TextMatrix(0, i) = arrName(i)
    ddd.TextMatrix(1, i) = ""
Next
ddd.Rows = 28

Call UpdateDDD(ddd, ExecSql("SELECT ID, Title, AnswerA, AnswerB, AnswerC, AnswerD, Answer FROM dbo.SingleProblem"), 1)
End Sub
Private Sub btnDel_Click()
'删除单选题
Call Exec_SqL("delete SingleProblem where id=" & idkey & " ")
Unload Me
End Sub

Private Sub btnSave_Click()
Dim strSelect As String
Dim i As Long
For i = 0 To 3
    If Me.Option1(i).Value = True Then
       strSelect = Me.Option1(i).Caption
    End If
Next
If idkey > 0 Then
   '修改单选题
   Call Exec_SqL("update SingleProblem set title='" & Me.txtTmnr.Text & "',AnswerA='" & Me.Text1.Text & "',AnswerB ='" & Me.Text2.Text & "',Answerc='" & Me.Text3.Text & "',AnswerD='" & Me.Text4.Text & "',Answer='" & strSelect & "' where id=" & idkey & " ")
Else
   '添加单选题
   Call Exec_SqL("insert into SingleProblem values('" & Me.txtTmnr.Text & "','" & Me.Text1.Text & "','" & Me.Text2.Text & "','" & Me.Text3.Text & "','" & Me.Text4.Text & "','" & strSelect & "')")
End If
Unload Me
End Sub

Private Sub Form_Load()
'显示当选题信息内容
Me.btnDel.Enabled = False
If idkey > 0 Then
   Dim tmprs As New ADODB.Recordset
   Set tmprs = ExecSql("select * from SingleProblem where id=" & idkey & "")
   With tmprs
       If .RecordCount > 0 Then
          Me.txtTmnr.Text = .Fields("Title").Value
          Me.Text1.Text = .Fields("AnswerA").Value
          Me.Text2.Text = .Fields("AnswerB").Value
          Me.Text3.Text = .Fields("AnswerC").Value
          Me.Text4.Text = .Fields("AnswerD").Value
          Dim i As Long
          For i = 0 To 3
              If Me.Option1(i).Caption = .Fields("Answer").Value Then
                 Me.Option1(i).Value = True
              End If
          Next
          Me.btnDel.Enabled = True
       End If
   End With
End If
If boolReadOnly Then
   Me.btnDel.Enabled = False
   Me.btnSave.Enabled = False
End If
End Sub


〖资料来源:计算机毕业论文 www.xiaoniu168.com

第6页为计算机毕业论文部分......

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网
计算机毕业设计客服
计算机毕业论文客服在线 计算机毕业论文客服在线
计算机毕业论文在线,计算机毕业设计在线