ndavenport
Member
- Joined
- Sep 2, 2009
- Messages
- 8
- Programming Experience
- Beginner
I have a listbox that contains several items (the amount of items changes depending on who is using the application). The listbox is setup so the user can select more then one item. I am attempting to submit the user selection(s) to the database. The problem I'm having is that when I loop through the array to find out what is selected, I'm only getting the first item selected (because I cannot deselect it).
For Counter = 0 To lstEmailFreq.SelectedItems.Count - 1
PreferenceKey = lstEmailFreq.SelectedValue 'Get the PreferenecKey for processing
'Next insert new records
Me.Tbl_FrequencyConfigurationsTableAdapter.Insert1(ClientKey, EmailChannel, PreferenceKey, EmailTimeFrame, EmailDuration, EmailCounter, 1)
Next
What I think I need is someway to deselect the first item from the listbox so the next loop through will grab the second item and so forth. I hope I'm being clear on this explination. Thanks in advance for any help.
For Counter = 0 To lstEmailFreq.SelectedItems.Count - 1
PreferenceKey = lstEmailFreq.SelectedValue 'Get the PreferenecKey for processing
'Next insert new records
Me.Tbl_FrequencyConfigurationsTableAdapter.Insert1(ClientKey, EmailChannel, PreferenceKey, EmailTimeFrame, EmailDuration, EmailCounter, 1)
Next
What I think I need is someway to deselect the first item from the listbox so the next loop through will grab the second item and so forth. I hope I'm being clear on this explination. Thanks in advance for any help.