坂田社保局电话:谁能找到用vb编写得考试系统

来源:百度文库 编辑:高校问答 时间:2024/05/02 20:15:01
谁能找到用vb编写得考试系统原代码,我需要
用vb6.0编写的,最好主要语句代码都有说明
有界面和完整版最好,能直接运行,谢谢
在12月23日10点前能够发到我的邮箱给20分345814603@163.com

form1:

Private Sub Command1_Click()

Dim cls2 As Class2
Set cls2 = New Class2
cls2.getstr2 (CStr(Text1.Text))
'MsgBox CStr(cls2.a0)
Dim a(10) As String
a(0) = cls2.a0 'kaohao
a(1) = cls2.a1 'name
a(2) = cls2.a2 'sex
a(3) = cls2.a3 'ximing
a(4) = cls2.a4 'grade
a(5) = cls2.a5 'class
Form2.Label1.Caption = "当前用户:" & a(1) & " " & "考号:" & a(0) & " " & "系名:" & a(3) & " " & "年级:" & a(4) & " " & "班级:" & a(5)

Form2.Show
'Form3.Show
End Sub

Private Sub Command2_Click()
End
End Sub

=============================================================

form2:

Dim a(10) As String

Private Sub Command1_Click()
MsgBox "你确定交卷吗?"
End Sub

Private Sub Form_Load()

Text1.Width = Form2.Width
Text1.Height = Form2.Height
Text1.Top = 0
Text1.Left = 0
'//////////////////////////////////////////导入数据
Text1.Text = "单项选择题" & vbNewLine
Text1.Text = Text1.Text & " " & vbNewLine

Dim i As Long
Dim cls As Class1
Set cls = New Class1
For i = 0 To 19

cls.getstr
a(0) = cls.a0 'id
a(1) = cls.a1 'subject
a(2) = cls.a2 'a
a(3) = cls.a3 'b
a(4) = cls.a4 'c
a(5) = cls.a5 'd
a(6) = cls.a6 'answer

Text1.Text = Text1.Text & CStr(i + 1) & "." & vbNewLine
Text1.Text = Text1.Text & a(1) & vbNewLine
Text1.Text = Text1.Text & "A:" & a(2) & " "
Text1.Text = Text1.Text & "B:" & a(3) & " "
Text1.Text = Text1.Text & "C:" & a(4) & " "
Text1.Text = Text1.Text & "D:" & a(5) & " " & vbNewLine
Text1.Text = Text1.Text & " " & vbNewLine
Next i

'//////////////////////////////////////////

End Sub

Private Sub Form_Resize()

Text1.Width = Form2.Width
Text1.Height = Form2.Height * 0.85
Text1.Top = Form2.Height * 0.15
Text1.Left = 0

Label1.Top = 0
Label1.Left = 0
Label1.Width = Form2.Width
'Label1.Height = Form2.Height * 0.2 * 0.1
Label1.AutoSize = True

Dim i As Integer
For i = 0 To 9
Form2.Combo1(i).Top = Form2.Height * 0.2 * 0.2

Form2.Combo1(i).Left = Form2.Width * i / 10

Form2.Combo1(i).Width = Form2.Width / 10
'Form2.Combo1(i).Height = Form2.Height * 0.2 * 0.4
Next i

For i = 10 To 19
Form2.Combo1(i).Top = Form2.Height * 0.2 * 0.4

Form2.Combo1(i).Left = Form2.Width * (i - 10) / 10

Form2.Combo1(i).Width = Form2.Width / 10
'Form2.Combo1(i).Height = Form2.Height * 0.2 * 0.4
Next i

Command1.Top = 0
Command1.Left = Form2.Width - Command1.Width

End Sub

=============================================================

class1.module

Dim a(10) As String

Public Function getstr() As String
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

conn.ConnectionString = "DSN=kaoshi"
conn.ConnectionTimeout = 30
conn.Open

Dim query As String

'======================================
query = "select * from tiku"
rs.Open query, conn, adOpenStatic, adLockOptimistic
Dim i As Long
rs.MoveFirst
i = 0
Do While (Not rs.EOF)
i = i + 1
rs.MoveNext
Loop

rs.Close

'MsgBox CStr(i)
Dim count As Long
Math.Randomize
count = i * Math.Rnd
If (1 <= count And count <= i) Then

Else
MsgBox "ERROR:" & CStr(count)
count = 1
End If

'MsgBox CStr(count)

'=======================================
query = "select * from tiku where id=" & CStr(count - 1)

rs.Open query, conn, adOpenStatic, adLockOptimistic

a(0) = CStr(rs!id)
a(1) = rs!subject
a(2) = rs!a
a(3) = rs!b
a(4) = rs!c
a(5) = rs!d
a(6) = rs!answer
'a(7) = rs!catalog
'a(8) = rs!nandu
'a(9) = rs!fenxi

rs.Close

conn.Close

End Function

Public Property Get a0() As Variant
a0 = a(0)
End Property

Public Property Let a0(ByVal vNewValue As Variant)

End Property

Public Property Get a1() As Variant
a1 = a(1)
End Property

Public Property Let a1(ByVal vNewValue As Variant)

End Property

Public Property Get a2() As Variant
a2 = a(2)
End Property

Public Property Let a2(ByVal vNewValue As Variant)

End Property

Public Property Get a3() As Variant
a3 = a(3)
End Property

Public Property Let a3(ByVal vNewValue As Variant)

End Property

Public Property Get a4() As Variant
a4 = a(4)
End Property

Public Property Let a4(ByVal vNewValue As Variant)

End Property

Public Property Get a5() As Variant
a5 = a(5)
End Property

Public Property Let a5(ByVal vNewValue As Variant)

End Property

Public Property Get a6() As Variant
a6 = a(6)
End Property

Public Property Let a6(ByVal vNewValue As Variant)

End Property

============================================================

class2.module

Dim a(10) As String

Public Function getstr2(str As String) As String
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

conn.ConnectionString = "DSN=kaoshi"
conn.ConnectionTimeout = 30
conn.Open

Dim query As String
Dim tmp%
tmp = 0
'=============判断
query = "select kaohao from student"
rs.Open query, conn, adOpenStatic, adLockOptimistic
rs.MoveFirst

Do While (Not rs.EOF)
If (rs!kaohao = str) Then
MsgBox "考号正确!!"
tmp = 1
Exit Do
Else
End If

rs.MoveNext

Loop

If (tmp = 0) Then
MsgBox "考号不正确!!"
End
End If

rs.Close
'=============

query = "select * from student where kaohao='" & str & "'"

rs.Open query, conn, adOpenStatic, adLockOptimistic

a(0) = rs!kaohao
a(1) = rs!Name
a(2) = rs!sex
a(3) = rs!ximing
a(4) = rs!grade
a(5) = rs!Class

rs.Close

conn.Close

End Function

Public Property Get a0() As Variant
a0 = a(0)
End Property

Public Property Let a0(ByVal vNewValue As Variant)

End Property

Public Property Get a1() As Variant
a1 = a(1)
End Property

Public Property Let a1(ByVal vNewValue As Variant)

End Property

Public Property Get a2() As Variant
a2 = a(2)
End Property

Public Property Let a2(ByVal vNewValue As Variant)

End Property

Public Property Get a3() As Variant
a3 = a(3)
End Property

Public Property Let a3(ByVal vNewValue As Variant)

End Property

Public Property Get a4() As Variant
a4 = a(4)
End Property

Public Property Let a4(ByVal vNewValue As Variant)

End Property

Public Property Get a5() As Variant
a5 = a(5)
End Property

Public Property Let a5(ByVal vNewValue As Variant)

End Property