The primary problem with InputBox is that it exists. You should basically avoid using it if you possibly can. If you have to use it because the assignment says so, which I suspect is the case here, then you are stuck. Otherwise, you should create your own form that matches the rest of your UI and display it as a modal dialogue.
Assuming that you must use InputBox then here is some pseudo-code:Unless you have been told that you can assume that the user input will always be a valid number, you should be using Decimal.TryParse to validate and convert rather than CDec, which will throw an exception if the data is not a valid number.Code:Do Call InputBox and get result If result is empty Exit Do Else Try to convert input to number and use as required End If Loop




Reply With Quote