this is a simple quiz program for addtion that generates random numbers and records the attempts and correct answers that were taken.
i have a problem, i need to have the percentage of the scores. i have a text2(number of attempts) text3(number of correct answers) the text4 should automalically have a the answers for the given formula (text2/text3)*100 to get the percentage..
also is there a code that i can use to dis able the (keyascii=13) after pressing it?
Dim ctr As Integer
Dim ctr2 As Integer
Dim aa As Integer
Dim bb As Integer
Dim cc As Integer
Private Sub Command1_Click()
Dim MyValue1 As Integer
Dim MyValue2 As Integer
MyValue1 = Int((20 * Rnd) + 1)
MyValue2 = Int((20 * Rnd) + 1)
Label1.Caption = MyValue1
Label2.Caption = MyValue2
Label3.Caption = ""
Text1.Text = ""
Text2.Text = ctr
ctr = ctr + 1
Image1.Visible = False
Command1.Enabled = False
End Sub
Private Sub Form_Load()
ctr = 1
ctr2 = 1
Randomize
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
aa = Label1.Caption
bb = Label2.Caption
cc = aa + bb
If KeyAscii = 13 Then
If Text1.Text = "" Then
MsgBox ("please enter a number")
ElseIf Text1.Text = cc Then
Text3.Text = ctr2
ctr2 = ctr2 + 1
Label3.Caption = "correct"
Image1.Visible = True
Image1.Stretch = True
Image1.Picture = LoadPicture("F:\Headtrip\School\3rd year\Computer 7\Montes\Random\smile.jpg")
Command1.Enabled = True
Else
Image1.Visible = True
Label3.Caption = "wrong"
Image1.Stretch = True
Image1.Picture = LoadPicture("F:\Headtrip\School\3rd year\Computer 7\Montes\Random\sad.jpg")
Command1.Enabled = True
End If
End If
End Sub