In my program there r 6 text boxes for subject scores and 6 labels to display grades for the scores.
eg txtMaths for Maths score and lblMaths for maths grade etc
In the program I only want the user to be able to input numbers between 0 and 100 inclusive.Else an error message appears.I have the following code that works fairly well
Private Sub txtMaths_Change()
On Error Resume Next
If CInt(txtMaths)<0 Then txtMaths = " "
If CInt(txtMaths)>100 Then txtMaths =" "
Select Case CInt(txtmaths)
Case 0 To 39:lblMaths="D"
etc
End select
End Sub.
My questions are
1.How do I get the error sg to appear
2. How EXACTLY can I get this code repeated for the otrher subjects without typing it for each subject? .
What about a control array and a loop ? will that work?
Can you give me the code to do this.
2007-03-14
16:17:54
·
3 answers
·
asked by
candy
1
in
Computers & Internet
➔ Programming & Design