|
-
Oct 29th, 2003, 11:01 PM
#1
Thread Starter
New Member
Validating Event
I have a form with 12 text boxes that require the same input validation. One for each month. How do I get it so that I only use one validating event to handle every text box instead of writing a seperate validating event for each text box? Thanks. This is what I have so far...
Private Sub txtjan_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtJan.Validating, txtFeb.Validating, txtMar.Validating, txtApr.Validating, txtMay.Validating, txtJun.Validating, txtJul.Validating, txtAug.Validating, txtSep.Validating, txtOct.Validating, txtNov.Validating, txtDec.Validating
'Need help here
If txtJan.Text = "" OrElse Not IsNumeric(txtJan.Text) OrElse CSng(txtJan.Text) < 0 Then
MessageBox.Show("You cannot enter a value less than zero.", "Error")
txtJan.SelectionStart = 0
txtJan.SelectionLength = txtJan.Text.Length
e.Cancel = True
Else
e.Cancel = False
End If
End Sub
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
|