Merhabalar,


2 adet listboxum var

listbox1 de 37 tane item olduğunu varsayalım.

Ben butona tıkladığım zaman ilk 10 tanesini listbox2 ye eklemesini istiyorum. Listbox 2 10 tane olduğunda butona tıkladığımda (Aynı butondan bahsediyorum farklı buton yok) itemleri tek tek secerek silmesini. Eğer hepsi silinmişse listboxdan kalan 10 u şeklinde eklemeye devam etmesi. En son 7 tane kalıyor. 7 tanesinide listbox2 ye ekleyip tek tek silmesini ve işlemi tamamlamasını istiyorum.

Bir turlu yapamadım.


Kod:
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click If ListBox2.Items.Count < 10 Then If ListBox2.Items.Count < 0 Then Else If ListBox1.Items.Count = 0 Then Else If ListBox1.SelectedIndex ListBox1.Items.Count - 1 Then ListBox1.SelectedIndex += 1 Else ListBox1.SelectedIndex = 0 ListBox2.Items.Add(ListBox1.SelectedItem) ListBox1.Items.Remove(ListBox1.SelectedItem) End If End If Else End If If ListBox2.Items.Count = 10 Then If ListBox2.SelectedIndex ListBox2.Items.Count - 1 Then ListBox2.SelectedIndex += 1 Else ListBox2.SelectedIndex = 0 ListBox2.Items.Remove(ListBox2.SelectedItem) End If End Sub

şu kodu kullandım istediğim olayı yapmıyor.
__________________