473,757 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ComboBox DataSets Qty

My Program: a local C# ADO.Net application using VS 2003

Right now I have about 5 ComboBox's which provides drop down selection
entries from the same MS-Access table via a DataConnection, DataAdapter and
DataSet datasource. Each CB has it's own DA and DS. When I tried to use the
same DS as the datadource for each of the five CB's, changing one of the CB's
selection affectd the other four CB's.

New business requirements require I increase the number of CB's from 5 to
about 100. What do I do? Do I create 100 DA and DS?

Steve
Nov 17 '05 #1
8 1982
Hi,
inline

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:82******** *************** ***********@mic rosoft.com...
My Program: a local C# ADO.Net application using VS 2003

Right now I have about 5 ComboBox's which provides drop down selection
entries from the same MS-Access table via a DataConnection, DataAdapter
and
DataSet datasource. Each CB has it's own DA and DS. When I tried to use
the
same DS as the datadource for each of the five CB's, changing one of the
CB's
selection affectd the other four CB's.
Instead of using a different DataSource (DataSet) for each ComboBox, you can
use a different BindingContext :

comboBox1.Bindi ngContext = new BindingContext( );
comboBox1.DataS ource = ds; // same datasource
comboBox1.Displ ayMember = ....;

comboBox2 .BindingContext = new BindingContext( );
comboBox2.DataS ource = ds; // same datasource
comboBox2.Displ ayMember = ....;

.....

This way the comboboxes will create different CurrencyManager s(which
mantains position) for the same datasource/datamember and allow independent
navigating.
HTH,
greetings


New business requirements require I increase the number of CB's from 5 to
about 100. What do I do? Do I create 100 DA and DS?

Steve

Nov 17 '05 #2
Hi,
inline

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:82******** *************** ***********@mic rosoft.com...
My Program: a local C# ADO.Net application using VS 2003

Right now I have about 5 ComboBox's which provides drop down selection
entries from the same MS-Access table via a DataConnection, DataAdapter
and
DataSet datasource. Each CB has it's own DA and DS. When I tried to use
the
same DS as the datadource for each of the five CB's, changing one of the
CB's
selection affectd the other four CB's.
Instead of using a different DataSource (DataSet) for each ComboBox, you can
use a different BindingContext :

comboBox1.Bindi ngContext = new BindingContext( );
comboBox1.DataS ource = ds; // same datasource
comboBox1.Displ ayMember = ....;

comboBox2 .BindingContext = new BindingContext( );
comboBox2.DataS ource = ds; // same datasource
comboBox2.Displ ayMember = ....;

.....

This way the comboboxes will create different CurrencyManager s(which
mantains position) for the same datasource/datamember and allow independent
navigating.
HTH,
greetings


New business requirements require I increase the number of CB's from 5 to
about 100. What do I do? Do I create 100 DA and DS?

Steve

Nov 17 '05 #3
Bart

Thank You for responding. Great Idea. Will try it this weekend.

One question, the DataSource and DisplayMember assignments are in VS CB
properties window. Where do I put the comboBox1.Bindi ngContext = new
BindingContext( ) statement so I get it in the order you specified or can I
put it anywhere (i.e. Constuctor, form Load() event)? Can I somehow get "new
BindingContext( )" into the VS CB (DataBinding) block ?? Or do I remove the
CB DataSource and DisplayMemeber and put it all in my code after the
InitializeCompo nent();

Steve

"Bart Mermuys" wrote:
Hi,
inline

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:82******** *************** ***********@mic rosoft.com...
My Program: a local C# ADO.Net application using VS 2003

Right now I have about 5 ComboBox's which provides drop down selection
entries from the same MS-Access table via a DataConnection, DataAdapter
and
DataSet datasource. Each CB has it's own DA and DS. When I tried to use
the
same DS as the datadource for each of the five CB's, changing one of the
CB's
selection affectd the other four CB's.


Instead of using a different DataSource (DataSet) for each ComboBox, you can
use a different BindingContext :

comboBox1.Bindi ngContext = new BindingContext( );
comboBox1.DataS ource = ds; // same datasource
comboBox1.Displ ayMember = ....;

comboBox2 .BindingContext = new BindingContext( );
comboBox2.DataS ource = ds; // same datasource
comboBox2.Displ ayMember = ....;

.....

This way the comboboxes will create different CurrencyManager s(which
mantains position) for the same datasource/datamember and allow independent
navigating.
HTH,
greetings


New business requirements require I increase the number of CB's from 5 to
about 100. What do I do? Do I create 100 DA and DS?

Steve


Nov 17 '05 #4
Bart

Thank You for responding. Great Idea. Will try it this weekend.

One question, the DataSource and DisplayMember assignments are in VS CB
properties window. Where do I put the comboBox1.Bindi ngContext = new
BindingContext( ) statement so I get it in the order you specified or can I
put it anywhere (i.e. Constuctor, form Load() event)? Can I somehow get "new
BindingContext( )" into the VS CB (DataBinding) block ?? Or do I remove the
CB DataSource and DisplayMemeber and put it all in my code after the
InitializeCompo nent();

Steve

"Bart Mermuys" wrote:
Hi,
inline

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:82******** *************** ***********@mic rosoft.com...
My Program: a local C# ADO.Net application using VS 2003

Right now I have about 5 ComboBox's which provides drop down selection
entries from the same MS-Access table via a DataConnection, DataAdapter
and
DataSet datasource. Each CB has it's own DA and DS. When I tried to use
the
same DS as the datadource for each of the five CB's, changing one of the
CB's
selection affectd the other four CB's.


Instead of using a different DataSource (DataSet) for each ComboBox, you can
use a different BindingContext :

comboBox1.Bindi ngContext = new BindingContext( );
comboBox1.DataS ource = ds; // same datasource
comboBox1.Displ ayMember = ....;

comboBox2 .BindingContext = new BindingContext( );
comboBox2.DataS ource = ds; // same datasource
comboBox2.Displ ayMember = ....;

.....

This way the comboboxes will create different CurrencyManager s(which
mantains position) for the same datasource/datamember and allow independent
navigating.
HTH,
greetings


New business requirements require I increase the number of CB's from 5 to
about 100. What do I do? Do I create 100 DA and DS?

Steve


Nov 17 '05 #5
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:D4******** *************** ***********@mic rosoft.com...
Bart

Thank You for responding. Great Idea. Will try it this weekend.

One question, the DataSource and DisplayMember assignments are in VS CB
properties window. Where do I put the comboBox1.Bindi ngContext = new
BindingContext( ) statement so I get it in the order you specified or can I
put it anywhere (i.e. Constuctor, form Load() event)? Can I somehow get
"new
BindingContext( )" into the VS CB (DataBinding) block ?? Or do I remove
the
CB DataSource and DisplayMemeber and put it all in my code after the
InitializeCompo nent();
It doesn't matter where you bind, from code or with the properties window.
The new BindingContext assignments can only be done in in code. A good
place would be after InitializeCompo nent() in the constructor.

If you want independent navigating, sorting and filtering, you can:
Create a different dataview for each combox and bind that ( from code or
designer ) .

If you only want independent navigating you can gain some performance:
Create a single dataview (designer or code) and bind that to all ComboBoxes
and then give each ComboBox a new BindingContext from code.
HTH,
greetings

Steve

"Bart Mermuys" wrote:
Hi,
inline

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:82******** *************** ***********@mic rosoft.com...
> My Program: a local C# ADO.Net application using VS 2003
>
> Right now I have about 5 ComboBox's which provides drop down selection
> entries from the same MS-Access table via a DataConnection, DataAdapter
> and
> DataSet datasource. Each CB has it's own DA and DS. When I tried to
> use
> the
> same DS as the datadource for each of the five CB's, changing one of
> the
> CB's
> selection affectd the other four CB's.


Instead of using a different DataSource (DataSet) for each ComboBox, you
can
use a different BindingContext :

comboBox1.Bindi ngContext = new BindingContext( );
comboBox1.DataS ource = ds; // same datasource
comboBox1.Displ ayMember = ....;

comboBox2 .BindingContext = new BindingContext( );
comboBox2.DataS ource = ds; // same datasource
comboBox2.Displ ayMember = ....;

.....

This way the comboboxes will create different CurrencyManager s(which
mantains position) for the same datasource/datamember and allow
independent
navigating.
HTH,
greetings

>
> New business requirements require I increase the number of CB's from 5
> to
> about 100. What do I do? Do I create 100 DA and DS?
>
> Steve
>
>


Nov 17 '05 #6
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:D4******** *************** ***********@mic rosoft.com...
Bart

Thank You for responding. Great Idea. Will try it this weekend.

One question, the DataSource and DisplayMember assignments are in VS CB
properties window. Where do I put the comboBox1.Bindi ngContext = new
BindingContext( ) statement so I get it in the order you specified or can I
put it anywhere (i.e. Constuctor, form Load() event)? Can I somehow get
"new
BindingContext( )" into the VS CB (DataBinding) block ?? Or do I remove
the
CB DataSource and DisplayMemeber and put it all in my code after the
InitializeCompo nent();
It doesn't matter where you bind, from code or with the properties window.
The new BindingContext assignments can only be done in in code. A good
place would be after InitializeCompo nent() in the constructor.

If you want independent navigating, sorting and filtering, you can:
Create a different dataview for each combox and bind that ( from code or
designer ) .

If you only want independent navigating you can gain some performance:
Create a single dataview (designer or code) and bind that to all ComboBoxes
and then give each ComboBox a new BindingContext from code.
HTH,
greetings

Steve

"Bart Mermuys" wrote:
Hi,
inline

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:82******** *************** ***********@mic rosoft.com...
> My Program: a local C# ADO.Net application using VS 2003
>
> Right now I have about 5 ComboBox's which provides drop down selection
> entries from the same MS-Access table via a DataConnection, DataAdapter
> and
> DataSet datasource. Each CB has it's own DA and DS. When I tried to
> use
> the
> same DS as the datadource for each of the five CB's, changing one of
> the
> CB's
> selection affectd the other four CB's.


Instead of using a different DataSource (DataSet) for each ComboBox, you
can
use a different BindingContext :

comboBox1.Bindi ngContext = new BindingContext( );
comboBox1.DataS ource = ds; // same datasource
comboBox1.Displ ayMember = ....;

comboBox2 .BindingContext = new BindingContext( );
comboBox2.DataS ource = ds; // same datasource
comboBox2.Displ ayMember = ....;

.....

This way the comboboxes will create different CurrencyManager s(which
mantains position) for the same datasource/datamember and allow
independent
navigating.
HTH,
greetings

>
> New business requirements require I increase the number of CB's from 5
> to
> about 100. What do I do? Do I create 100 DA and DS?
>
> Steve
>
>


Nov 17 '05 #7
Bart,

Again thank you for the free input

Yes, I do want sorting of the comboBox dropdown but didn't know how to do it
Not real familar dataview but have used it once or twice - need to check it
out.

"Bart Mermuys" wrote:
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:D4******** *************** ***********@mic rosoft.com...
Bart

Thank You for responding. Great Idea. Will try it this weekend.

One question, the DataSource and DisplayMember assignments are in VS CB
properties window. Where do I put the comboBox1.Bindi ngContext = new
BindingContext( ) statement so I get it in the order you specified or can I
put it anywhere (i.e. Constuctor, form Load() event)? Can I somehow get
"new
BindingContext( )" into the VS CB (DataBinding) block ?? Or do I remove
the
CB DataSource and DisplayMemeber and put it all in my code after the
InitializeCompo nent();


It doesn't matter where you bind, from code or with the properties window.
The new BindingContext assignments can only be done in in code. A good
place would be after InitializeCompo nent() in the constructor.

If you want independent navigating, sorting and filtering, you can:
Create a different dataview for each combox and bind that ( from code or
designer ) .

If you only want independent navigating you can gain some performance:
Create a single dataview (designer or code) and bind that to all ComboBoxes
and then give each ComboBox a new BindingContext from code.
HTH,
greetings

Steve

"Bart Mermuys" wrote:
Hi,
inline

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:82******** *************** ***********@mic rosoft.com...
> My Program: a local C# ADO.Net application using VS 2003
>
> Right now I have about 5 ComboBox's which provides drop down selection
> entries from the same MS-Access table via a DataConnection, DataAdapter
> and
> DataSet datasource. Each CB has it's own DA and DS. When I tried to
> use
> the
> same DS as the datadource for each of the five CB's, changing one of
> the
> CB's
> selection affectd the other four CB's.

Instead of using a different DataSource (DataSet) for each ComboBox, you
can
use a different BindingContext :

comboBox1.Bindi ngContext = new BindingContext( );
comboBox1.DataS ource = ds; // same datasource
comboBox1.Displ ayMember = ....;

comboBox2 .BindingContext = new BindingContext( );
comboBox2.DataS ource = ds; // same datasource
comboBox2.Displ ayMember = ....;

.....

This way the comboboxes will create different CurrencyManager s(which
mantains position) for the same datasource/datamember and allow
independent
navigating.
HTH,
greetings
>
> New business requirements require I increase the number of CB's from 5
> to
> about 100. What do I do? Do I create 100 DA and DS?
>
> Steve
>
>


Nov 17 '05 #8
Bart

Hope your still there, It gets a little more differcult.

The db may already have a entry for that field that should be loaded as
ComboBox.text when the form opens. The user should also have a choice to
edit the field without changing the other 20 "charaCode" fields

From IntializeCompon ent() method:
this.charaCode1 CB.DataBindings .Add(new System.Windows. Forms.Binding(" Text",
this.csiDbDS, "Main.Character isticCodes1"));

Adding "charaCode1CB.B indingContext = new BindingContext( );" seems to
remove that previous binding

Steve


"Bart Mermuys" wrote:
Hi,
inline

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:82******** *************** ***********@mic rosoft.com...
My Program: a local C# ADO.Net application using VS 2003

Right now I have about 5 ComboBox's which provides drop down selection
entries from the same MS-Access table via a DataConnection, DataAdapter
and
DataSet datasource. Each CB has it's own DA and DS. When I tried to use
the
same DS as the datadource for each of the five CB's, changing one of the
CB's
selection affectd the other four CB's.


Instead of using a different DataSource (DataSet) for each ComboBox, you can
use a different BindingContext :

comboBox1.Bindi ngContext = new BindingContext( );
comboBox1.DataS ource = ds; // same datasource
comboBox1.Displ ayMember = ....;

comboBox2 .BindingContext = new BindingContext( );
comboBox2.DataS ource = ds; // same datasource
comboBox2.Displ ayMember = ....;

.....

This way the comboboxes will create different CurrencyManager s(which
mantains position) for the same datasource/datamember and allow independent
navigating.
HTH,
greetings


New business requirements require I increase the number of CB's from 5 to
about 100. What do I do? Do I create 100 DA and DS?

Steve


Nov 17 '05 #9

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

Similar topics

0
992
by: | last post by:
I have made a Visual Basic.NET Program that pull info from a Form with a ComboBox that pulls info from one table. Then when you click the save button it should update a different table in Sql 2000. I am using 2 Datasets one for read and one Read/Write. I Did this with: (DataBindings)
0
254
by: Steve B. | last post by:
My Program: a local C# ADO.Net application using VS 2003 Right now I have about 5 ComboBox's which provides drop down selection entries from the same MS-Access table via a DataConnection, DataAdapter and DataSet datasource. Each CB has it's own DA and DS. When I tried to use the same DS as the datadource for each of the five CB's, changing one of the CB's selection affectd the other four CB's. New business requirements require I...
4
1735
by: Alpha | last post by:
I have a small Window application and through out the different forms I create a different dataset. At the begining I used the Tools to drag and drop the SqlDataAdapter, connection and dataset objects to the frist few forms but then later I removed those and created these objects in my code. I now see 3 datasets in the Solution Explorer panel part but not all the datasets that I have in my codes. Are these 3 datasets leftover from the...
6
1385
by: Dany P. Wu | last post by:
Hi everyone, As usual, weekend is tinkering time for students and I'm playing with combobox databinding for the first time. Previously I have always iterated through the records and added each item in the rows manually. Just thought it would be nice to do it properly for a change. Here's the bit of code I experiment with: ============================================================================ ======================== Private Sub...
1
1327
by: redwebgeek | last post by:
Hi, I've been searching this one for two days so thought I give this a shot again. I have two datasets Dataset1 and Dataset2 Dataset1 populates a datagrid and dataset2 populates a combobox within the datagrid. When I try using SqlCommandBuilder it doesn't work since I am using two datasets. So am I looking for a way to update the table for dataset1 using a field from the combobox.
2
2452
by: Phil | last post by:
I need to created a typed dataset for a xml flat file and bind that dataset to a combobox. I was able to do this in VS.Net 2003 easy enough, but can't get it to work in VS.Net 2005. I've come close, but can't seem to get the right steps down to make this happen. Thanks.
0
1094
by: massenza | last post by:
All, Still a newbie, could someone help me out with this. When I load/Open my form my comboboxes which are tied to datasets all have the first value of the dataset listed in the text area of the combobox. I want to be able to open the form, have the datasets loaded in the combo boxes, but I don't want any initial value selected. A code example mentioning the right place to do this would be GREATLY appreciated. Thank You in Advance.
8
13402
by: =?Utf-8?B?RyBIdXN0aXM=?= | last post by:
This is the 2nd time posting so sorry for duplications. I am using VB.NT 2005 & a standard Combobox. I've been wracking my brain over this problem for a over a month & cannot seem to find a way to trap the pressing of a Tab Key when the focus is in a Combobox. The KeyDown or KeyUp event for a combobox will not fire when the tab key is pressed. The Keyup event will fire when the Tab key is used to tab into the combo, however I want to trap...
12
3602
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a gridview, for example, I loop through a datareader, populating an array list with instances of a custom class in the middle tier, and then send the array list up to the presentation layer and bind the gridview to it. If I use a typed dataset, I...
0
9297
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.