Home All Groups Group Topic Archive Search About

DataBinding and Combo Boxes

Author
29 Mar 2006 12:31 AM
Dennis
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?

--
Dennis in Houston

Author
29 Mar 2006 3:28 AM
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.
Author
29 Mar 2006 5:36 AM
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


Show quoteHide quote
"Dennis" <Den***@discussions.microsoft.com> schreef in bericht
news:889EA0BA-04DF-487C-A7EF-3F969996592A@microsoft.com...
>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?
>
> --
> Dennis in Houston
Author
30 Mar 2006 12:07 AM
Dennis
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.

--
Dennis in Houston


Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> 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
>
>
> "Dennis" <Den***@discussions.microsoft.com> schreef in bericht
> news:889EA0BA-04DF-487C-A7EF-3F969996592A@microsoft.com...
> >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?
> >
> > --
> > Dennis in Houston
>
>
>
Author
30 Mar 2006 6:56 AM
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



Show quoteHide quote
"Dennis" <Den***@discussions.microsoft.com> schreef in bericht
news:4414EA7C-C03C-4E60-955D-F66389987E72@microsoft.com...
>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.
>
> --
> Dennis in Houston
>
>
> "Cor Ligthert [MVP]" wrote:
>
>> 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
>>
>>
>> "Dennis" <Den***@discussions.microsoft.com> schreef in bericht
>> news:889EA0BA-04DF-487C-A7EF-3F969996592A@microsoft.com...
>> >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?
>> >
>> > --
>> > Dennis in Houston
>>
>>
>>
Author
30 Mar 2006 11:59 PM
Dennis
Thanks Cor.  I suspected that it wasn't that easy to do with a dataset.
--
Dennis in Houston


Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> 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
>
>
>
> "Dennis" <Den***@discussions.microsoft.com> schreef in bericht
> news:4414EA7C-C03C-4E60-955D-F66389987E72@microsoft.com...
> >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.
> >
> > --
> > Dennis in Houston
> >
> >
> > "Cor Ligthert [MVP]" wrote:
> >
> >> 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
> >>
> >>
> >> "Dennis" <Den***@discussions.microsoft.com> schreef in bericht
> >> news:889EA0BA-04DF-487C-A7EF-3F969996592A@microsoft.com...
> >> >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?
> >> >
> >> > --
> >> > Dennis in Houston
> >>
> >>
> >>
>
>
>