By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,075 Members | 798 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,075 IT Pros & Developers. It's quick & easy.

Listbox Loop

P: 374
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 in the listbox2

how could i replace that with the actual value ?
Jul 10 '09 #1
Share this Question
Share on Google+
1 Reply

P: 374
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()
Jul 10 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.