473,394 Members | 1,721 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,394 software developers and data experts.

three combos, same dataset

Hi

I have a form with multi-tabs, and on each tab I have a one combo that has
the same values.
I populate all 3 combo with the same one datacall/dataset
My problem is: when I make a value selection change to one, it changes the
other 2 combos on the other 2 tabs.

Is there a way to make one datacall, but have three seperate acting controls?

At the moment I have to call the same data call three time.

//Code Example
DataSet selectDataSet = DataCalls.RetrieveTypeOfFood();
DataSet menuDataSet = DataCalls.RetrieveTypeOfFood();
DataSet newDataSet = DataCalls.RetrieveTypeOfFood();

//*************************************
DataView dv = new DataView();
DataRow dr;
dr = selectDataSet.Tables[0].NewRow();
dr["Code"] = " - Select Type - ";
dr["CodeID"] = 0;
selectDataSet.Tables[0].Rows.Add(dr);
dv.Table = selectDataSet.Tables[0];
dv.Sort = "Code ASC";
SelectTypeComboBox.DisplayMember = "Code";
SelectTypeComboBox.ValueMember = "CodeID";
SelectTypeComboBox.DataSource = dv;

//**************************************
DataView mdv = new DataView();
DataRow mdr;
mdr = menuDataSet.Tables[0].NewRow();
mdr["Code"] = " - Select Type - ";
mdr["CodeID"] = 0;
menuDataSet.Tables[0].Rows.Add(mdr);
mdv.Table = menuDataSet.Tables[0];
mdv.Sort = "Code ASC";
MenuTypeComboBox.DisplayMember = "Code";
MenuTypeComboBox.ValueMember = "CodeID";
MenuTypeComboBox.DataSource = mdv;

//**************************************
DataView ndv = new DataView();
DataRow ndr;
ndr = newDataSet.Tables[0].NewRow();
ndr["Code"] = " - Select Type - ";
ndr["CodeID"] = 0;
newDataSet.Tables[0].Rows.Add(ndr);
ndv.Table = newDataSet.Tables[0];
ndv.Sort = "Code ASC";
NewTypesComboBox.DisplayMember = "Code";
NewTypesComboBox.ValueMember = "CodeID";
NewTypesComboBox.DataSource = ndv;

Thanks
Brian
Jan 6 '06 #1
3 1171
Set each combo to have its own BindingContext.

"BrianDH" <Br*****@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
Hi

I have a form with multi-tabs, and on each tab I have a one combo that has
the same values.
I populate all 3 combo with the same one datacall/dataset
My problem is: when I make a value selection change to one, it changes the
other 2 combos on the other 2 tabs.

Is there a way to make one datacall, but have three seperate acting
controls?

At the moment I have to call the same data call three time.

//Code Example
DataSet selectDataSet = DataCalls.RetrieveTypeOfFood();
DataSet menuDataSet = DataCalls.RetrieveTypeOfFood();
DataSet newDataSet = DataCalls.RetrieveTypeOfFood();

//*************************************
DataView dv = new DataView();
DataRow dr;
dr = selectDataSet.Tables[0].NewRow();
dr["Code"] = " - Select Type - ";
dr["CodeID"] = 0;
selectDataSet.Tables[0].Rows.Add(dr);
dv.Table = selectDataSet.Tables[0];
dv.Sort = "Code ASC";
SelectTypeComboBox.DisplayMember = "Code";
SelectTypeComboBox.ValueMember = "CodeID";
SelectTypeComboBox.DataSource = dv;

//**************************************
DataView mdv = new DataView();
DataRow mdr;
mdr = menuDataSet.Tables[0].NewRow();
mdr["Code"] = " - Select Type - ";
mdr["CodeID"] = 0;
menuDataSet.Tables[0].Rows.Add(mdr);
mdv.Table = menuDataSet.Tables[0];
mdv.Sort = "Code ASC";
MenuTypeComboBox.DisplayMember = "Code";
MenuTypeComboBox.ValueMember = "CodeID";
MenuTypeComboBox.DataSource = mdv;

//**************************************
DataView ndv = new DataView();
DataRow ndr;
ndr = newDataSet.Tables[0].NewRow();
ndr["Code"] = " - Select Type - ";
ndr["CodeID"] = 0;
newDataSet.Tables[0].Rows.Add(ndr);
ndv.Table = newDataSet.Tables[0];
ndv.Sort = "Code ASC";
NewTypesComboBox.DisplayMember = "Code";
NewTypesComboBox.ValueMember = "CodeID";
NewTypesComboBox.DataSource = ndv;

Thanks
Brian

Jan 6 '06 #2
Brian,

I never saw it this way, however I don't know why this is not working, can
you try it like this.

DataView ndv = new DataView(newDataSet.Tables[0]);
DataRow ndr;
ndr = newDataSet.Tables[0].NewRow();
ndr["Code"] = " - Select Type - ";
ndr["CodeID"] = 0;
newDataSet.Tables[0].Rows.Add(ndr); \\\ ndv.Table = newDataSet.Tables[0]; ndv.Sort = "Code ASC";
NewTypesComboBox.DisplayMember = "Code";
NewTypesComboBox.ValueMember = "CodeID";
NewTypesComboBox.DataSource = ndv;

Be aware that you are probably adding 3 times a row to the same datatable.

In addition probably it is better to ask this in the CSharp newsgroup, not
that we are not able to help you, however a Csharp question does not look so
well if there is a search done in this newsgroup.

I hope this helps,

Cor
Jan 6 '06 #3
Thank you that worked!

"BrianDH" wrote:
Hi

I have a form with multi-tabs, and on each tab I have a one combo that has
the same values.
I populate all 3 combo with the same one datacall/dataset
My problem is: when I make a value selection change to one, it changes the
other 2 combos on the other 2 tabs.

Is there a way to make one datacall, but have three seperate acting controls?

At the moment I have to call the same data call three time.

//Code Example
DataSet selectDataSet = DataCalls.RetrieveTypeOfFood();
DataSet menuDataSet = DataCalls.RetrieveTypeOfFood();
DataSet newDataSet = DataCalls.RetrieveTypeOfFood();

//*************************************
DataView dv = new DataView();
DataRow dr;
dr = selectDataSet.Tables[0].NewRow();
dr["Code"] = " - Select Type - ";
dr["CodeID"] = 0;
selectDataSet.Tables[0].Rows.Add(dr);
dv.Table = selectDataSet.Tables[0];
dv.Sort = "Code ASC";
SelectTypeComboBox.DisplayMember = "Code";
SelectTypeComboBox.ValueMember = "CodeID";
SelectTypeComboBox.DataSource = dv;

//**************************************
DataView mdv = new DataView();
DataRow mdr;
mdr = menuDataSet.Tables[0].NewRow();
mdr["Code"] = " - Select Type - ";
mdr["CodeID"] = 0;
menuDataSet.Tables[0].Rows.Add(mdr);
mdv.Table = menuDataSet.Tables[0];
mdv.Sort = "Code ASC";
MenuTypeComboBox.DisplayMember = "Code";
MenuTypeComboBox.ValueMember = "CodeID";
MenuTypeComboBox.DataSource = mdv;

//**************************************
DataView ndv = new DataView();
DataRow ndr;
ndr = newDataSet.Tables[0].NewRow();
ndr["Code"] = " - Select Type - ";
ndr["CodeID"] = 0;
newDataSet.Tables[0].Rows.Add(ndr);
ndv.Table = newDataSet.Tables[0];
ndv.Sort = "Code ASC";
NewTypesComboBox.DisplayMember = "Code";
NewTypesComboBox.ValueMember = "CodeID";
NewTypesComboBox.DataSource = ndv;

Thanks
Brian

Jan 9 '06 #4

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

Similar topics

3
by: James P. | last post by:
Help, In Access 2000, I have a bound column - textbox. As soon as I type three dots (periods) in the textbox and keep typing (more dots or anything else), it automatically converts the three...
1
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
3
by: VMI | last post by:
I'm currently using the dataAdapter.Fill method to fill my dataset with data from an Access DB. My dataset will contain a table with three fields from Access. In my datagrid (for user...
2
by: mangia | last post by:
I want to display three-across address labels on a Web page. I am using a dataset that is bound to a three-column data grid. In my aspx page, I fill the data grid with the current dataset. ...
1
by: G .Net | last post by:
Hi I have a DataGrid which has combos in the first field. These combos are populated via a DataView from another table. When I click the header of the field i.e. to sort it, the rows are sorted...
2
by: Gordowey | last post by:
Hi all,...I have an special situation, that I can not solve.... I need some help This is my scenario: 1.- I have n-combos (showing available rooms from an hotel) in my web-page. The number of...
11
by: Zebra Code | last post by:
hi all i should copy the items of a combo to n other combos. it's not a cycle: With cboColor1 .Items.Add("ffffff") .Items.Add("cecece") ... .SelectedIndex = 0
3
by: sberry | last post by:
I have three arrays... for instance $a = array('big', 'small', 'medium'); $b = array('old', 'new'); $c = array('blue', 'green'); I want to take those and end up with all of the combinations...
3
by: ilikebirds | last post by:
I am looking for a way to have one combo lookup drop down to autopopulate with multiple items based off another combo lookup. I've tried Me!rc1 = DLookup("", "", "Reject_Reason_1='" &...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.