Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Urgent help needed (continued)

markblue777markblue777 Member Posts: 184
Hi first of all thx for ur help to everyone who responded to the first part of this question (Jonathan many thanks) but now for the second part when i have added this coding (that was shown to me) in the correct place it comes up with a run time error '5' with the message of invalid procedure call or argument on this line

the code that i have added to stop the txtbox from being writen in after the question has been typed is al followed

Private Sub txtAnswer_KeyPress(KeyAscii As Integer)
Dim Ans As Integer
''Only allow numbers, minus sign, decimal point, return key
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbkeyMinus Or KeyAscii = vbKeyDecPt Or KeyAscii = vbKeyBack Then
Exit Sub
txtAnswer.Enabled = True ' To allow people to type in it again
ElseIf KeyAscii = vbKeyReturn Then
'Check answer
Ans = Val(txtAnswer.Text)
If Ans = sum Then
NumRight = NumRight + 1
lblMessage.Caption = "That's The Correct Answer!"
lblMessage.Caption = "Your Answer Is Wrong The Correct Anser Is " + Format(sum, "#0")
End If
lblScore.Caption = Format(1000 * NumRight / NumProb, "##0")
cmdNext.Enabled = True
txtAnswer.Enabled = False ' To stop people typing in it
KeyAscii = 0
End If
End Sub

many thanks in advanced thanks


Sign In or Register to comment.