Page 1 of 1
Listbox
Posted: Sat Apr 24, 2010 2:33 pm
by NeedHelp
I want something like this:
If you select something in listbox1 it changes things in listbox2 like this:
You select -Game- in listbox1 this comes up in listbox2:
-1
-2
-3
and if you select -no game- in listbox1 this comes up in listbox2:
-4
-5
-8
any ideas?
Re: Listbox
Posted: Sat Apr 24, 2010 5:04 pm
by Agust1337
Well what you could do if I understand you right:
under Public class put these codes:
Code: Select allDim nr1 As String = "-1"
Dim nr2 As String = "-2"
Dim nr3 As String = "-3"
Dim nr4 As String = "-4"
Dim nr5 As String = "-5"
Dim nr8 As String = "-8"
Then double click ListBox1 and put these codes:
(should be Listbox1_SelectedIndexChanged)
Code: Select all If ListBox1.Text = "Game" Then
ListBox2.Items.Add(nr1 & vbNewLine)
ListBox2.Items.Add(nr2 + vbNewLine)
ListBox2.Items.Add(nr3 + vbNewLine)
If ListBox2.Items.Contains(nr4) Then
ListBox2.Items.Remove(nr4)
End If
If ListBox2.Items.Contains(nr5) Then
ListBox2.Items.Remove(nr5)
End If
If ListBox2.Items.Contains(nr8) Then
ListBox2.Items.Remove(nr8)
End If
Else
If ListBox1.Text = "No game" Then
If ListBox2.Items.Contains(nr1) Then
ListBox2.Items.Remove(nr1)
End If
If ListBox2.Items.Contains(nr2) Then
ListBox2.Items.Remove(nr2)
End If
If ListBox2.Items.Contains(nr3) Then
ListBox2.Items.Remove(nr3)
End If
ListBox2.Items.Add(nr4 & vbNewLine)
ListBox2.Items.Add(nr5 + vbNewLine)
ListBox2.Items.Add(nr8 + vbNewLine)
End If
End If
Re: Listbox
Posted: Sat Apr 24, 2010 6:17 pm
by NeedHelp
Yes like that but when you click on it 'game' 2 times it duplicate... and so on with no game to
Re: Listbox
Posted: Sun May 02, 2010 4:50 pm
by mandai
Maybe you could call Listbox.Items.Clear on the listbox you aren't clicking on before you add the items?