473,386 Members | 1,720 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,386 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 6175
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.