Groups | Blog | Home
all groups > dotnet windows forms databinding > may 2005 >

dotnet windows forms databinding : DataBindings and DataSource


Christopher Weaver
5/11/2005 2:29:13 PM
Can anyone tell me the relationships between the following properties of a
ComboBox:

DataBindings.SelectedItem
DataBindings.SelectedValue
DataBindings.Text
DataBindings.Tag
DataSource
DisplayMember
ValueMember

It seems to me that there would be some conflict here if one were to use all
of these simultaneously. The SelectedItem, SelectedValue, Tag and Text
properties all allow for the selection of a DataSource and DisplayMember.
ValueMember serves the same purpose as SelectedValue and takes precedence
over it.

Has anyone written a definitive discussion of how these elements relate to
one another? Would anyone like to now?


Beth Massi [Architect MVP]
5/12/2005 4:50:19 PM
I wrote about a couple combobox use cases here:
http://bethmassi.blogspot.com/2005/04/combobox-databinding-woes.html

HTH,
-B

[quoted text, click to view]

Chris Smith
6/20/2005 9:44:10 AM
These are already documented in the MSDN.

But they all work together.

Example.

Datasource, Display member and Value member, set all these to have your
combo box bind the selected datasource, "display" a selected field/property
and have the "value" of the selected field/property when clicked on in the
combobox.

Have a look at the docs, should be explained well there.

Best of luck,

Chris


[quoted text, click to view]

AddThis Social Bookmark Button