12,403,418 members (74,049 online)
Rate this:
See more:
Team,

Need Your help in completing the below concept.

I have 2 listboxes with collections in it

Now what i require is,

until both list is empty, the first item of both listbox should be displayed in 3rd listbox.

For example.

list1 list2

123 778
234 909
355 344

it should look like

list3

123
778

only first index. ( onetime). this should get removed while adding the next set.

Posted 18-Apr-13 15:40pm
Member 9989624 18-Apr-13 22:11pm

i use this code. its working good for every click. how to loop this until both list is empty?

<pre lang="vb">
Dim selected As Object
Dim selected1 As Object
selected1 = ListBox2.Items(0).ToString
selected = ListBox1.Items(0).ToString
ListBox3.Items.Clear()
ListBox2.Items.RemoveAt(0)
ListBox1.Items.RemoveAt(0)
</pre>

Rate this:

## Solution 1

As long as both listbox have the same number of items:

```Dim myList As New List(Of String)
Dim total As Integer = listbox1.Items.Count -1
For i As Integer = 0 To total
Next
For Each str As String In myList
Next
listbox1.Items.Clear()
listbox2.Items.Clear()
```
v3
Member 9989624 18-Apr-13 22:29pm

This code wrks good. Howerever what i need is only the first index of both listbox should be added in 3rd list. once the first index of listbox 1 and listbox 2 is added those should be removed.

This should happen till the first listbox is empty.

Idle_Force 18-Apr-13 22:34pm

Updated!
Member 9989624 18-Apr-13 22:38pm

Fantastic:) Thanks a lot.
Member 9989624 18-Apr-13 23:00pm

Top Experts
Last 24hrsThis month
 OriginalGriff 353 Karthik Bangalore 230 Richard MacCutchan 177 Suvendu Shekhar Giri 175 RossMW 85
 OriginalGriff 7,346 Karthik Bangalore 3,127 ppolymorphe 3,080 Richard MacCutchan 2,308 F-ES Sitecore 2,222

Web02 | 2.8.160721.1 | Last Updated 18 Apr 2013