Listbox1 to Listbox2
How would I take results from a database and make them into ListItems for a listbox?
I'm trying to populate listbox1 with e-mails and then using a button to add a single value(at a time) to listbox2. In other words, listbox1 will have all the e-mails from the database and listbox2 will have only the e-mails that will get an e-mail. I can populate listbox1 with the database results, it just won't let me add any values to listbox2 from there. I'm thinking that it doesn't know the index value.
Here's my code
Dim conPubs As SqlConnection
Dim cmdSelectAuthors As SqlCommand
Dim dtrAuthors As SqlDataReader
conPubs = New SqlConnection(ConfigurationSettings.appSettings("STDConnect"))
cmdSelectAuthors = New SqlCommand("Select * from Email", conPubs)
dtrAuthors = cmdSelectAuthors.ExecuteReader()
Now, this works. It populates my listbox with the e-mails. The problem I'm having is not being able to add an e-mail from this listbox into listbox2 by highlighting and submitting a value. Any ideas?
Here is how to add the selected item from ListBox1 to ListBox2:
Hope that helps..
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)