Connecting Tech Pros Worldwide Help | Site Map

Listbox Loop

OuTCasT's Avatar
Needs Regular Fix
 
Join Date: Jan 2008
Location: South Africa
Posts: 353
#1: Jul 10 '09
I have bound a listbox with a dataTable

Now i want to move the values from the listbox to another listbox.
i have changed the selectionMode of the listbox to multiple.

So they choose multiple items and they get moved over to the other listbox.

Expand|Select|Wrap|Line Numbers
  1. for each item in listbox1.selecteditems
  2. listbox2.items.add(item)
  3. next
i get system.data.datarowview in the listbox2

how could i replace that with the actual value ?
OuTCasT's Avatar
Needs Regular Fix
 
Join Date: Jan 2008
Location: South Africa
Posts: 353
#2: Jul 10 '09

re: Listbox Loop


Expand|Select|Wrap|Line Numbers
  1. sqlCon.Open()
  2.             sqlAdapter = New SqlDataAdapter(sqlCom)
  3.             sqlTable = New DataTable
  4.             sqlAdapter.Fill(sqlTable)
  5.             Dim s As String
  6.             For i = 0 To sqlTable.Rows.Count - 1
  7.                 s = sqlTable.Rows(i)("emailaddress").ToString
  8.                 ListBox1.Items.Add(s)
  9.             Next
  10.             sqlCon.Close()
Reply