From the course: Visual Basic Essential Training

Unlock the full course today

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

Challenge: Refactor with parameters

Challenge: Refactor with parameters - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Challenge: Refactor with parameters

(upbeat music) - [Instructor] I've got a coding challenge for you. You're going to modify the code in this existing application so that the user can choose the max value for the random number generator. So we'll type a value in there and then when they click the get odd button, it'll use a number up to this max value. Same thing with the even button. You're also going to create some new functionality where when you click on this button it's going to get a random squared number. Though the instructions for that are over here in mainwidow.xaml.vb. The challenge part one is to allow the user to choose a max value by entering an integer in the number text box, and don't forget to validate the input for integer values. And do the same thing here in RunCode2. And here is where you'll write the new code. So you're going to show a random squared value when this button is clicked, two, four, nine, 16, and so on. And I'd like…

Contents