Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- Dim _NrOfTimes As String
- Dim _counter As Integer
- ListBox1.Items.Clear()
- Try
- _NrOfTimes = CInt(Val(TextBox1.Text))
- '_NrOfTimes = Convert.ToInt32("_string_nr") ' converting string to number
- If _NrOfTimes = 0 Then 'wrong input - empty or string
- MsgBox("Please enter a number")
- Else : getList(_NrOfTimes)
- End If
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- End Sub
- Function getList(ByVal nr As Integer)
- Const a = 100, b = 200
- Dim _randomnum As Integer
- Dim _counter As Integer '??
- Randomize()
- For i = 1 To nr
- _randomnum = Int(Rnd() * (b - a + 1) + a)
- ListBox1.Items.Add(_randomnum & " - " & _counter)
- Next
- Return True
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement