If Then and controls [Resolved]
I have hit a snag in a program I am trying to create. I came up with this program as a goal for myself in my efforts at learning VB.NET; I would like to finish the darn thing mainly to help myslef learn but also to help my mother's obsession with the lottery. Here's the code I have at the moment that throws all kinds of errors.
Code:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Output = TextBox1.Text ;Where the results are displayed in multiline
Dim Rangeone = TextBox2.Text ;Lowest number to randomize
Dim Rangetwo = TextBox3.Text ;Highest number to randomize
Dim Picks = TextBox4.Text ;How many seperate rows of numbers is displayed
Dim Plays = TextBox5.Text ;How many numbers per row are displayed
Dim r As New System.Random()
If Picks = "1" Then
Output.Text = r.Next(Rangeone, Rangetwo + 1)
Else : Picks = ""
MsgBox("You must enter the number of picks")
End If
If Picks = "2" Then
Output.Text = r.Next(Rangeone, Rangetwo + 1) & vbCrLf
Else : Picks = ""
MsgBox("You must enter the number of picks")
End If
If Picks = "3" Then
Output.Text = r.Next(Rangeone, Rangetwo + 1)
Else : Picks = ""
MsgBox("You must enter the number of picks")
End If
End Sub
End Class
I need help showing the correct number of rows
as in the commented section of Dim Picks = TextBox4.Text
I need help formatting the code so that it will show the correct number of numbers per row
as in the commented section of Dim Plays = TextBox5.Text
The output of each number in each row needs to be seperated with a [ before each number and a ] after it too.
Example input for Rangeone = 1
Example input for Rangetwo = 12
Example input for Picks = 3
Example input for Plays = 6
Example of output would look like
[02] [10] [03] [06] [05] [09]
[07] [08] [04] [11] [01] [12]
[03] [02] [12] [01] [09] [06]
Pointers, thoughts and examples are appreciated but remember I am very new to VB.NET still.
Help with If Then and controls [RESOLVED]
A "BIG" thank you taxes for setting me straight. :wave: