28-12-14, 12:23 PM
السلام عليكم اخواني
مطلوب مني اصمم برنامج معلومات في اخره اختبار بسيط
عملت كل شي بس توقفت عن الكومن الي اذا ضغطه تظهر نتيجة الاختبار ..
اتمني مساعدتكم..
هذا الكود الي استخدمته
مطلوب مني اصمم برنامج معلومات في اخره اختبار بسيط
عملت كل شي بس توقفت عن الكومن الي اذا ضغطه تظهر نتيجة الاختبار ..
اتمني مساعدتكم..
هذا الكود الي استخدمته
كود :
Dim qno, question(), ans(), correct(), response()
Const numq = 4 ' total number of questions
Private Sub cmdNext_Click()
qno = qno + 1
SetQuestion
End Sub
Private Sub Command1_Click()
End Sub
Private Sub Command2_Click()
Qiuz1.Hide
Chapter1.Show
End Sub
Private Sub Form_Load()
ReDim question(numq), ans(numq, 4), correct(numq), response(numq)
FillArrays
qno = 1
SetQuestion
End Sub
Private Sub SetQuestion()
cmdNext.Enabled = (qno <> numq)
lblQno.Caption = qno
lblQuestion.Caption = question(qno)
For n = 1 To 4
optAns(n).Caption = ans(qno, n)
optAns(n).Value = False
Next
If response(qno) <> "" Then
optAns(response(qno)).Value = True
End If
End Sub
Private Sub FillArrays()
question(1) = "What is the most popular programming language in the world?"
ans(1, 1) = "C++"
ans(1, 2) = "Pascal"
ans(1, 3) = "Visual Basic"
ans(1, 4) = "Java"
correct(1) = 3 ' the correct answer, Visual Basic,
' has the index value 3 above
question(2) = "Which VB control has no caption property?"
ans(2, 1) = "Textbox"
ans(2, 2) = "Commandbutton"
ans(2, 3) = "Label"
ans(2, 4) = "PictureBox"
correct(2) = 1 ' the correct answer to the second
' question is answer 1, "textbox"
question(3) = "What would this code display? MsgBox(2 + 2 / 2 + 2)"
ans(3, 1) = "1"
ans(3, 2) = "4.5"
ans(3, 3) = "5"
ans(3, 4) = "An error message"
correct(3) = 3 ' VB will do the division first, then 2+1+2
question(4) = "When a VB program is run, which event happens first?"
ans(4, 1) = "Dim" ' not an event
ans(4, 2) = "Form_Load"
ans(4, 3) = "cmd1_Click"
ans(4, 4) = "Form_Run"
correct(4) = 2
End Sub
Private Sub optAns_Click(Index As Integer)
response(qno) = Index
End Sub