[RESOLVED] listbox problem
hello,
Hope someone can help with listbox problem.I have two forms.on form 1 i have button and textbox,form 2 there is a listbox.I have 100 random numbers in listbox.when i press button on form1 i want textbox to display a totally different number each time.I already done this in vb6 but i want to convert it to vb 2008.
in vb6 i use
< Code:
Randomize
Form1.Text1.Text = Form2.List1.List(Int(Rnd() * Form2.List1.ListCount))
This generates a different number in textbox.
Re: [RESOLVED] listbox problem
Absolutely perfect thanks very much dbasnett.
. Code:
If Form2.ListBox1.Items.Count > 0 Then
Dim i As Integer = rndm.Next(0, Form2.ListBox1.Items.Count)
Me.TextBox1.Text = Form2.ListBox1.Items(i).ToString
Form2.ListBox1.Items.RemoveAt(i)
End If