i have 5 textboxes with 5 labels representing candidates and a cast vote button i have set up the arrays and am trying to use the textboxes to vote giving preferences from 1 to 5 although i would like if possible to be able to have the choice of a 1,2,3 vote or a 1,2,3,4,5 vote that would be the voters choice i set the maximum character property to 1 so only 1 digit could be entered also didnt want letters or 0,6,7,8,9 so i entered
Private Sub TextBox1_KeyPress1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress, TextBox4.KeyPress, TextBox5.KeyPress
Select Case (e.KeyChar)
Case "1"
Case "2"
Case "3"
Case "4"
Case "5"
End Select
If Not Char.IsNumber(e.KeyChar) Then
e.Handled = True
End If
End Sub
but 6,7 etc can still be entered i am stuck how could i do this any help would be much appreciated
Private Sub TextBox1_KeyPress1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress, TextBox4.KeyPress, TextBox5.KeyPress
Select Case (e.KeyChar)
Case "1"
Case "2"
Case "3"
Case "4"
Case "5"
End Select
If Not Char.IsNumber(e.KeyChar) Then
e.Handled = True
End If
End Sub
but 6,7 etc can still be entered i am stuck how could i do this any help would be much appreciated