Picking A Random Number From ListBox
Hi guys i need your help i have a code that randomly generates thigs from listbox
The code is:
Thats the code but i need when randomly pick items from listbox to select that item in the listbox(highlight it)
I need that becouse i will import this code after is selected to split the strings from the selected item from the listbox to 2 textboxes
So please tell me a code that randomly pick item from the lisrbox and selects the same item in the listbox
Imageshack - capturekll.png
Please help
The code is:
Code:
Dim rnd As New Random
Dim randomIndex As Integer = rnd.Next(0, ListBox1.Items.Count - 1)
subjectbox.Text = ListBox1.Items(randomIndex)
I need that becouse i will import this code after is selected to split the strings from the selected item from the listbox to 2 textboxes
Code:
Dim str, str1() As String
str = ListBox1.SelectedItem.ToString
str1 = Strings.Split(str)
TextBox4.Text = str1(0)
TextBox5.Text = str1(1)
Imageshack - capturekll.png
Please help
