-
Combobox question
I have a combobox in my search form that is created dynamically when the page loads, when a user hits the refresh button to get an updated results total I need to have the values they selected to stay selected. This is the code I am using
Code:
Dim tlist(20) As String
Dim i As Integer
tlist = Split(Request(name), ",")
For i = 0 To 20
f.SelectedIndex = f.Items.Item(tlist(i))
Next
This works great if I only select 1 item, but if I select multiple I get an error. I am using a multi select combobox and thats why I thought I would have to use an array to do it. But I get "Specified argument was out of the range of valid values. Parameter name: 601,1" when I refresh (601,1 being the values I have selected) and it highlights the "Dim tlist(20) as string" line.
-
Do you actually have 21 items in your list or only 20? If you have only 20, your loop should go from 0 to 19.