From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Refactor with parameters

Solution: Refactor with parameters - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Solution: Refactor with parameters

(lively music) - [Instructor] Welcome back. How did you make out with that last challenge? I hope you had some success. I'd like to go over my solution to the chapter challenge. Please remember it might be different from yours. So the first challenge, was to allow the user to choose a max value by entering an integer in that NumberTextBox and validate the information when it comes in from that text box. So here's how I validated the data. I created a maxValue integer. Then on line 13 I did a TryParse for that number, and if it's not an integer then I output an error message to the screen and exit the Sub. If it is a good number then I call GetRandomOddNumber. I do the same thing for the even number. I have the same code here, and I do the same thing for my new code down here for the squared number. Next on line 18, I call GetRandomOddNumber. This is similar to the code we had before except now I'm passing in the…

Contents