' I tried this one to start. It seems to move the listbox item out of the Listbox and move it to a Textbox
Private R As New Random
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.Items.Count > 0 Then
Dim index As Integer = R.Next(0, ListBox1.Items.Count)
TextBox1.Text = ListBox1.Items(index)
ListBox1.Items.RemoveAt(index)
End If
If ListBox1.Items.Count = 0 Then
Button1.Enabled = False
End If
End Sub
' Then I tried thie code which changes the order of the highlight - not the actual items :(
Dim listcount As Integer = ListBox1.Items.Count
Dim index As Integer
Dim temp As Object
Dim r As New Random
ListBox1.BeginUpdate()
For i As Integer = 0 To listcount - 1
index = r.Next(0, listcount)
temp = ListBox1.Items(i)
ListBox1.Items(i) = ListBox1.Items(index)
ListBox1.Items(index) = temp
Next
ListBox1.EndUpdate()
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE