Código vb:
Ver originaldim i,j,k as integer
k=0
for i = 0 to contactsListBox.Items.Count - 1
for j =0 to DS.tables.rows.count - 1
if (contactsListBox.selectitem= i) =DS.tables(0).rows(j).item(0) then
listbox2.items.insert(k,dato a agregar)
k+1
endif
next j
next i