|
-
Jul 7th, 2004, 10:29 AM
#1
Thread Starter
Member
Textbox allows only < 100 & late binding
I have 3 textboxes on my form and each can only contain a number < 100, so I made the following;
Private Sub STH(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Text1.KeyPress, Text2.KeyPress, Text3.KeyPress
Dim KeyAscii As Integer
KeyAscii = Asc(e.KeyChar)
Select Case KeyAscii
Case 8, 13
Case 48 To 57
If sender.Text.Length > 1 Then
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
If KeyAscii = 0 Then
e.Handled = True
Else
e.Handled = False
End If
End Sub
But I've got option strict on and this gives the error;
Option Strict On disallows late binding.
I can ignore the error message, or remove option strict and it works, but is there a way to fix this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|