On Dec 7, 12:15 am, Davej <[email protected]> wrote:
> Apparently the standard VB combobox only has two columns? One column
> is displayed while the other has a numeric index value? I see some
> multi-column combo boxes are out there such as;
>
> http://www.codeproject.com/KB/architecture/MultiColumnFlatCombo.aspx
>
> ...But I don't think I need all that. I tried loading the standard
> combobox from a datatable with four columns and it seemed to load and
> function ok. Am I correct about that? If so that will allow me to do
> what I want to do -- extract the other columns by finding the row with
> the combobox.selectedindex or .selectedvalue.
>
> Thanks.


I have proceeded with this and am satisfied with it. Originally I did
not know if a combo box would be happy with a dt datasource with extra
rows but it seems to ignore them entirely.

If combobox1.SelectedIndex >= 0 Then

           str0 = combobox1.SelectedValue.ToString
           str1 = combobox1.Text
           str2 = dt.Rows(combobox1.SelectedIndex)(2).ToString() '
where dt is the combobox datasource
           str3 = dt.Rows(combobox1.SelectedIndex)(3).ToString()
           str4 = dt.Rows(combobox1.SelectedIndex)(4).ToString()
           str5 = dt.Rows(combobox1.SelectedIndex)(5).ToString()
           str6 = dt.Rows(combobox1.SelectedIndex)(6).ToString()

End If

Reply via email to