|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
three combos, same datasetI 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 Set each combo to have its own BindingContext.
Show quoteHide quote "BrianDH" <Bria***@discussions.microsoft.com> wrote in message news:BE69F70E-8049-4109-9531-662AD67A61FD@microsoft.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 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; \\\ ndv.Table = newDataSet.Tables[0];> ndr = newDataSet.Tables[0].NewRow(); > ndr["Code"] = " - Select Type - "; > ndr["CodeID"] = 0; > newDataSet.Tables[0].Rows.Add(ndr); > ndv.Sort = "Code ASC"; Be aware that you are probably adding 3 times a row to the same datatable.> NewTypesComboBox.DisplayMember = "Code"; > NewTypesComboBox.ValueMember = "CodeID"; > NewTypesComboBox.DataSource = ndv; > 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 Thank you that worked!
Show quoteHide quote "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
Armin - Start sound problem revived in new thread
Use of delegate SetWindowsHookEx and VB.NET 2005 A Framework for Datadriven Forms for VB Dot Net XML Comments File Generated Byte Array, Datagrid Simple Example of How to Implement SerialPort Class Paging, Filtering and Sorting Db Interaction spped issue with upgraded code from vb6 to vb.net Add a line break in label.text |
|||||||||||||||||||||||