Results 1 to 13 of 13

Thread: [RESOLVED] Loop until the user inputs a valid answer?

Threaded View

  1. #1

    Thread Starter
    Addicted Member riechan's Avatar
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    254

    Resolved [RESOLVED] Loop until the user inputs a valid answer?

    Hi guys. Is it possible for you to loop a block of code until the user provides a valid input? Like, when I click the save button, the program will prompt the user for an integer value, and I would like to validate if the user has inputted a valid value. If the user fails to input a valid value, then the program will re-prompt the same message again until the user inputs a valid value. Eg:

    Code:
    If MsgBox("Add copies to this book?", MsgBoxStyle.YesNo, "Adding Book Copies") = MsgBoxResult.Yes Then
    
    Dim CopyQty As String = InputBox("Amount of copies to generate:", "Add Book Copy")
            If IsNumeric(CopyQty) = False or (CopyQty < 1) Then
                MsgBox("Please key in a valid amount of copies to generate.", MsgBoxStyle.Information, "Invalid Input")
                'Show input box again
            End If
    
    end if
    Last edited by riechan; Feb 16th, 2010 at 07:42 AM.
    ====================
    ほんとにどもありがとう!

    Rie Ishida

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