I posted this in dotnet.language s.vb.controls but thought I'd post here as
well..
I have a combobox that is bound to a dataview generated from a dataset.
The dataset has a single table (called "Data") with two columns "Id" and
"Descriptio n". Id contains a code and description contains the
description that is displayed in the combobox.
The dataview is generated from the dataset using dv =
ds.Tables("Data ").DefaultV iew.
The Combobox is bound using :
txtLookup.DataS ource = dv
txtLookup.Value Member = "Id"
txtLookup.Displ ayMember = "Descriptio n"
This works fine, I can read the current "Id" from the combobox using the
txtlookup.selec tedvalue property.
However, if I want to programatically set the starting value of the
combobox, I can't seem to work out how to do it. I thought I could just set
the selectedvalue property to any of the vaules of "id" and the combobox
would then display the corresponding description. This appears not to be
the case. I don't know if it is getting confused by the fact that the "Id"
field in the datatable is numeric or if I'm just doing it wrong!
What should I be doing?
Thanks in advance
Simon
well..
I have a combobox that is bound to a dataview generated from a dataset.
The dataset has a single table (called "Data") with two columns "Id" and
"Descriptio n". Id contains a code and description contains the
description that is displayed in the combobox.
The dataview is generated from the dataset using dv =
ds.Tables("Data ").DefaultV iew.
The Combobox is bound using :
txtLookup.DataS ource = dv
txtLookup.Value Member = "Id"
txtLookup.Displ ayMember = "Descriptio n"
This works fine, I can read the current "Id" from the combobox using the
txtlookup.selec tedvalue property.
However, if I want to programatically set the starting value of the
combobox, I can't seem to work out how to do it. I thought I could just set
the selectedvalue property to any of the vaules of "id" and the combobox
would then display the corresponding description. This appears not to be
the case. I don't know if it is getting confused by the fact that the "Id"
field in the datatable is numeric or if I'm just doing it wrong!
What should I be doing?
Thanks in advance
Simon
Comment