DataBinding and Combo Boxes


G

Guest

I am trying to create a form using databinding to a dataset and one of the
fields requires the user to select from a list of optons. Any hints on how
to do this other than bind the field to a label or text box to display the
current field value then add a combo box with the list of items to chose from?
 
Ad

Advertisements

S

Steven Nagy

I'm sorry but I don't quite understand the question. Could you reword
it please, and I will do my best to answer it.

(for standard binding to a combobox, known as "complex binding" for
some bizarre reason...)

mycombo.datasource = myDataTable ' or, myDataset.Tables(0) or
myDataset.Tables("tablename")
mycombo.DisplayMember = "DisplayField" ' whichever column you want
to display in the combobox
mycombo.ValueMember = "IDField" ' whichever column is the
uniquely identifying column in a row.
 
C

Cor Ligthert [MVP]

Dennis,

As Steven told, give us some more information, from this I cannot get only
gues.

As we are talking about databinding, than the datasource is important
(bindingsource whatever).

As well the properties we want to bind to. For about what you are talking is
probably the dataview your first friend.

Cor
 
G

Guest

I have a form that is bound to a dataset. On it, there are some text box
controls and also a combo box that I want to display the current dataset row
fields and let the user edit then save to the current dataset row being
displayed.

For the combo box, I want to display the current value of the field in the
current DataSet Row and allow the user to change it by selecting a new value
from a drop down list. I can add the allowable values to the combobox but
can't seem to get the combobox to show the current field value using
databinding.
 
C

Cor Ligthert [MVP]

Dennis,

This sample is with a datagrid, (mainly to show the different ways of
databinding) however it is mainly the same. As soon as you have databind
something it is sticked to the current row.
If you want to let them work independent, than you have to create seperate
dataviews.

http://www.vb-tips.com/default.aspx?ID=5f4a0f68-a3b6-4fc8-8aff-587f730fa118

A problem is that using the combobox textbox for operations seems for me one
chain of bugs.
I reported lately one for 2005.

Also I have posted in past those in different newsgroups to see a reaction.
I got the idea than the Combobox problems are a plague I have never got any
reaction.

However, I hope this helps, and otherwise reply.

Cor
 
Ad

Advertisements

Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top