Home All Groups Group Topic Archive Search About

Databinding 2 comboboxes to the same Datasource

Author
16 May 2006 5:07 PM
ECathell
I am trying to databind 2 combo boxes to the same datasource but different fields using the same lookup table. The information in combobox2 is duplicating combobox 1(ie it appears to be gathering the wrong information) I have verified the proper information through query analyzer....

Me.FormatName1ComboBox.DataSource = LabelFormats

Me.FormatName1ComboBox.DisplayMember = "Formatname"

Me.FormatName1ComboBox.ValueMember = "FormatName"

Me.FormatName1ComboBox.DataBindings.Add(New Binding("SelectedValue", ProductsBindingsource, "FormatName1"))

Me.FormatName2ComboBox.DataSource = LabelFormats

Me.FormatName2ComboBox.DisplayMember = "Formatname"

Me.FormatName2ComboBox.ValueMember = "FormatName"

Me.FormatName2ComboBox.DataBindings.Add(New Binding("SelectedValue", ProductsBindingsource, "FormatName2"))


--
--Eric Cathell, MCSA

Author
16 May 2006 5:21 PM
Ken Tucker [MVP]
Hi,

         The currency manager will keep the 2 comboboxes in sync when they
are bound to the same datasource.  Create a dataview to bind one of the
comboboxes to.

Ken
---------------------------

Show quoteHide quote
"ECathell" wrote:

> I am trying to databind 2 combo boxes to the same datasource but different fields using the same lookup table. The information in combobox2 is duplicating combobox 1(ie it appears to be gathering the wrong information) I have verified the proper information through query analyzer....
>
> Me.FormatName1ComboBox.DataSource = LabelFormats
>
> Me.FormatName1ComboBox.DisplayMember = "Formatname"
>
> Me.FormatName1ComboBox.ValueMember = "FormatName"
>
> Me.FormatName1ComboBox.DataBindings.Add(New Binding("SelectedValue", ProductsBindingsource, "FormatName1"))
>
> Me.FormatName2ComboBox.DataSource = LabelFormats
>
> Me.FormatName2ComboBox.DisplayMember = "Formatname"
>
> Me.FormatName2ComboBox.ValueMember = "FormatName"
>
> Me.FormatName2ComboBox.DataBindings.Add(New Binding("SelectedValue", ProductsBindingsource, "FormatName2"))
>
>
> --
> --Eric Cathell, MCSA
Author
16 May 2006 6:05 PM
Cor Ligthert [MVP]
A little addition before it is misunderstood

*New* dataview

Cor
Author
16 May 2006 6:13 PM
ECathell
so because they both have the same datasource(lookup table) they will stay
in sync? so really then I need to create a second instance of the lookup
datasource....ok...seem redundant since it is the SAME lookup datasource and
bound to different columns of the products datasource...


Show quoteHide quote
"Ken Tucker [MVP]" <KenTucker***@discussions.microsoft.com> wrote in message
news:3FE56675-9C77-410D-8890-B187C286222C@microsoft.com...
> Hi,
>
>         The currency manager will keep the 2 comboboxes in sync when they
> are bound to the same datasource.  Create a dataview to bind one of the
> comboboxes to.
>
> Ken
> ---------------------------
>
> "ECathell" wrote:
>
>> I am trying to databind 2 combo boxes to the same datasource but
>> different fields using the same lookup table. The information in
>> combobox2 is duplicating combobox 1(ie it appears to be gathering the
>> wrong information) I have verified the proper information through query
>> analyzer....
>>
>> Me.FormatName1ComboBox.DataSource = LabelFormats
>>
>> Me.FormatName1ComboBox.DisplayMember = "Formatname"
>>
>> Me.FormatName1ComboBox.ValueMember = "FormatName"
>>
>> Me.FormatName1ComboBox.DataBindings.Add(New Binding("SelectedValue",
>> ProductsBindingsource, "FormatName1"))
>>
>> Me.FormatName2ComboBox.DataSource = LabelFormats
>>
>> Me.FormatName2ComboBox.DisplayMember = "Formatname"
>>
>> Me.FormatName2ComboBox.ValueMember = "FormatName"
>>
>> Me.FormatName2ComboBox.DataBindings.Add(New Binding("SelectedValue",
>> ProductsBindingsource, "FormatName2"))
>>
>>
>> --
>> --Eric Cathell, MCSA
Author
17 May 2006 6:03 AM
Cor Ligthert [MVP]
But as Ken said is the postion of the row by the currencymanager bound

Show quoteHide quote
"ECathell" <ecathell@nospam.com> schreef in bericht
news:uxpV$RReGHA.380@TK2MSFTNGP04.phx.gbl...
> so because they both have the same datasource(lookup table) they will stay
> in sync? so really then I need to create a second instance of the lookup
> datasource....ok...seem redundant since it is the SAME lookup datasource
> and bound to different columns of the products datasource...
>
>
> "Ken Tucker [MVP]" <KenTucker***@discussions.microsoft.com> wrote in
> message news:3FE56675-9C77-410D-8890-B187C286222C@microsoft.com...
>> Hi,
>>
>>         The currency manager will keep the 2 comboboxes in sync when they
>> are bound to the same datasource.  Create a dataview to bind one of the
>> comboboxes to.
>>
>> Ken
>> ---------------------------
>>
>> "ECathell" wrote:
>>
>>> I am trying to databind 2 combo boxes to the same datasource but
>>> different fields using the same lookup table. The information in
>>> combobox2 is duplicating combobox 1(ie it appears to be gathering the
>>> wrong information) I have verified the proper information through query
>>> analyzer....
>>>
>>> Me.FormatName1ComboBox.DataSource = LabelFormats
>>>
>>> Me.FormatName1ComboBox.DisplayMember = "Formatname"
>>>
>>> Me.FormatName1ComboBox.ValueMember = "FormatName"
>>>
>>> Me.FormatName1ComboBox.DataBindings.Add(New Binding("SelectedValue",
>>> ProductsBindingsource, "FormatName1"))
>>>
>>> Me.FormatName2ComboBox.DataSource = LabelFormats
>>>
>>> Me.FormatName2ComboBox.DisplayMember = "Formatname"
>>>
>>> Me.FormatName2ComboBox.ValueMember = "FormatName"
>>>
>>> Me.FormatName2ComboBox.DataBindings.Add(New Binding("SelectedValue",
>>> ProductsBindingsource, "FormatName2"))
>>>
>>>
>>> --
>>> --Eric Cathell, MCSA
>
>