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




Reply With Quote