Results 1 to 6 of 6

Thread: Validate Input *RESOLVED*

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    131

    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:
    1. If txtTransaction.Text <= "0" Then
    2.             MessageBox.Show("Please enter an amount > 0.", "Error")
    3.             txtTransaction.Focus()
    4.         End If
    Last edited by twisted; Jun 15th, 2004 at 11:21 AM.
    Twisted

  2. #2
    Lively Member
    Join Date
    Nov 2003
    Location
    Chicagoland
    Posts
    92

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    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:
    1. If txtTransaction.Text <= "0" Then
    2.             MessageBox.Show("Please enter an amount > 0.", "Error")
    3.             txtTransaction.Focus()
    4.         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.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    131
    Thanks! How do I stop the sub procedure after this executes and point it back to the beginning??
    Twisted

  5. #5
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    HI,

    VB Code:
    1. If val(txtTransaction.Text) <= 0 Then
    2.   MessageBox.Show("Please enter an amount > 0.", "Error")
    3.   txtTransaction.Text=""
    4.   Exit Sub
    5. 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.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    131
    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!
    Twisted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width