473,288 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

Databinding 2 comboboxes to the same Datasource

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
May 16 '06 #1
4 6169
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

May 16 '06 #2
A little addition before it is misunderstood

*New* dataview

Cor
May 16 '06 #3
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]" <Ke**********@discussions.microsoft.com> wrote in message
news:3F**********************************@microsof t.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

May 16 '06 #4
But as Ken said is the postion of the row by the currencymanager bound

"ECathell" <ec******@nospam.com> schreef in bericht
news:ux*************@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]" <Ke**********@discussions.microsoft.com> wrote in
message news:3F**********************************@microsof t.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


May 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Timothy White | last post by:
I have a Windows Form Which Displays one record at a time. The DataTable object which is bound to the Form Controls only contains the record that is being displayed. When I need to display a...
1
by: Stijn Goris | last post by:
Hi all, I have 3 Comboboxes i want to bind with 3 different DatTables. I use this.cbxProductCategory.DataSource = myDataTable; this.cbxProductCategory.DisplayMember = "PTCA_DESCR";...
5
by: david.kao | last post by:
Hi All: I have a dataset contains two tables, one parent child relation between two tables. I have no trouble to bind parent table to a combobox, relation to a win grid control. But I am having...
1
by: Gary Shell | last post by:
I have a pair of combo boxes on a form. Both have their SelectedValue property bound to a column on a table called "Input_Output". One column is called "Class" and the second is called "SubClass"....
2
by: Bruno Rodrigues | last post by:
The controls in my form are bounded to a datasource, including textboxes, comboboxes, etc... Something lame happens: In runtime, the last focused control before clicking on my save button, doesn't...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
5
by: Anthony Bollinger | last post by:
I have two tables in a master-detail relationship. When I make a selection in one combobox, how do I have it display the values from a second combobox? Each table has a key and a text value for...
7
by: JTC^..^ | last post by:
When i attempt to bind to the "Text" and "Value" property of a combobox on a windows form the value is reset when I leave the combobox. The comboboxes contain the correct Text and Values. I know...
0
by: theleshie | last post by:
Hi, I am creating an application which dynamically creates forms depending on the information held in a dataset (which also includes the data the application itself uses). As part of dynamically...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.