|
-
Jun 14th, 2004, 01:13 PM
#1
Thread Starter
Addicted Member
Validate Input *RESOLVED*
this is the only problem I'm still having. I didn't put it in my last thread b/c I figured everything else out. Anyway I need to make an if, then statement for this:
If not number or = 0 or < 0 then display message box
This is what I got and it works fine, but don't know how to make it appear if someone enters Text (ex:asfasfafsas)
VB Code:
If txtTransaction.Text <= "0" Then
MessageBox.Show("Please enter an amount > 0.", "Error")
txtTransaction.Focus()
End If
Last edited by twisted; Jun 15th, 2004 at 11:21 AM.
Twisted
-
Jun 14th, 2004, 01:52 PM
#2
Lively Member
-
Jun 14th, 2004, 05:44 PM
#3
PowerPoster
Re: Validate Input
Originally posted by twisted
this is the only problem I'm still having. I didn't put it in my last thread b/c I figured everything else out. Anyway I need to make an if, then statement for this:
If not number or = 0 or < 0 then display message box
This is what I got and it works fine, but don't know how to make it appear if someone enters Text (ex:asfasfafsas)
VB Code:
If txtTransaction.Text <= "0" Then
MessageBox.Show("Please enter an amount > 0.", "Error")
txtTransaction.Focus()
End If
Hi,
You have already received an answer to this in your previous threads
If val(txtTransaction.Text) <= 0 Then
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jun 15th, 2004, 06:37 AM
#4
Thread Starter
Addicted Member
Thanks! How do I stop the sub procedure after this executes and point it back to the beginning??
-
Jun 15th, 2004, 07:10 AM
#5
PowerPoster
HI,
VB Code:
If val(txtTransaction.Text) <= 0 Then
MessageBox.Show("Please enter an amount > 0.", "Error")
txtTransaction.Text=""
Exit Sub
End If
This will return you to the calling routine and clear the text box for a correct entry. This assumes that you carry out the calculations and updating of textboxes after the "End If" above.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jun 15th, 2004, 11:21 AM
#6
Thread Starter
Addicted Member
Thanks again! I have finished this assignment and I'll be working on my next one, which I'm sure you'll hear from me. Thanks again!
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
|