G
Guest
Hi,
I have form where i am using a listbox where we can select multiple values.I
am storing the selected values concatenating with commas(for eg.
"22,21,19,16").Now i have to update this form, so i have to retrieve these
values and to hightlight the previously selected values.
If HcbTypeRecordsOld(i) <> "" Then 'HcbTypeRecordsOld(i)
values from the database is "22,21,19,16"
If Split(HcbTypeRecordsOld(i), ",").Length > 1 Then
'Checking for multiple selection
Dim j As Integer
For j = 0 To Split(HcbTypeRecordsOld(i),
",").Length - 1
Dim
strSelectedValue(Split(HcbTypeRecordsOld(i), ",").Length) As String
strSelectedValue =
Split(HcbTypeRecordsOld(i), ",")
Dim iSelectedIndex As Integer
iSelectedIndex =
Convert.ToInt32(strSelectedValue(j))
cbTypeRecords.SelectedIndex = iSelectedIndex
Next
Else
cbTypeRecords.SelectedIndex =
Convert.ToInt32(HcbTypeRecordsOld(i))
End If
End If
How to set all the values as selected? Now "16" only set as selected.
Thanks
Kumar
I have form where i am using a listbox where we can select multiple values.I
am storing the selected values concatenating with commas(for eg.
"22,21,19,16").Now i have to update this form, so i have to retrieve these
values and to hightlight the previously selected values.
If HcbTypeRecordsOld(i) <> "" Then 'HcbTypeRecordsOld(i)
values from the database is "22,21,19,16"
If Split(HcbTypeRecordsOld(i), ",").Length > 1 Then
'Checking for multiple selection
Dim j As Integer
For j = 0 To Split(HcbTypeRecordsOld(i),
",").Length - 1
Dim
strSelectedValue(Split(HcbTypeRecordsOld(i), ",").Length) As String
strSelectedValue =
Split(HcbTypeRecordsOld(i), ",")
Dim iSelectedIndex As Integer
iSelectedIndex =
Convert.ToInt32(strSelectedValue(j))
cbTypeRecords.SelectedIndex = iSelectedIndex
Next
Else
cbTypeRecords.SelectedIndex =
Convert.ToInt32(HcbTypeRecordsOld(i))
End If
End If
How to set all the values as selected? Now "16" only set as selected.
Thanks
Kumar