Rnd() produced a floating point value that you had to manipulate to get it into the range you wanted to work with, then convert it into an integer. That's what all the *x + n stuff was about when you used Rnd(). The Random object is superior to that, because you just tell it the range you want as arguments to the Next method:

For values from 0 through 25:

value = RandomClass.Next(26)

For values from 5 through 25:

value = RandomClass.Next(5,26)

Note that the lower value is included in the range, but the upper value is one higher than the range that you want. Also note that if the bottom of the range is 0, you don't even need to mention it, and only the upper bound is needed. Furthermore, since .Next returns an Integer, you don't have to convert it into an integer with CInt, because it already IS an integer.


As for the Double.TryParse, there are many ways you could work with this. The question you need to decide is what you want to do if the entry in the textbox is NOT a number, which means that it contains non-numeric characters, or was left empty. What you want to do in that case will determine the best solution for you. One option would look like this:
Code:
If Not Double.TryParse(TextBox1.Text, variable1) Then
 Windows.Forms.MessageBox.Show("You didn't enter a number!","Invalid Number")
 Return
End If
Doing something like that for each of your TryParse statements would mean that if the user clicked that button without entering valid numbers in the boxes, they would get a message, then nothing more would happen. That's the simplest possible solution. Of course, it would be better if the message indicated which textbox had bad information.

Written this way, if there was something bad in the first textbox, the second textbox wouldn't even be examined. A much more complicated alternative would be to check each textbox, noting any problems with either one, and if either had a problem, then show those problems. This would allow the user to see ALL problems at once, rather than going through each one in turn. That's probably excessive for this program, but when you are validating MANY different inputs where the user could have made many different types of errors, then it would make more sense.

Other people would take issue with my use of Return. There is a school of thought, to which I do not subscribe fully, that believes that all functions should have only one return point. If you believe that way, you could change the code such that it looked like this:
Code:
If Double.TryParse(Textbox1.Text,variable1) Then
 If Double.TryParse(Textbox2.Text,variable2) Then
  'All is well, the rest of your method goes here.
 Else
  'The second variable is bad, put up a message.
 End If
Else
 'The first variable is bad, put up a message.
End If
So there are options, as you can see.