473,386 Members | 1,758 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.

Can each combobox in a datagridview column have unique values and if so how?

Hi

I have a situation where in I have two combo boxes in a datagridview control. The first combo box items are all static. But the second combo box items need to change based on the first combo box value selected. The problem I am running into is if I bind the datasource to the column the values are all the same all the time. Please help.

Sonny
Sep 8 '06 #1
4 4058
This may help:

http://www.thescripts.com/forum/post2081478-2.html
Sep 8 '06 #2
Thanks for the information. It still is not helping me since my current situation is this.

I have a datagridview which has two combobox columns. I want the items listed and available for selection to change on one combobox to change based on the item selected on the other.

Hopefully this gives a clearer picture.

And thanks for helping me out with this issue.
Sep 8 '06 #3
Thanks for the information. It still is not helping me since my current situation is this.

I have a datagridview which has two combobox columns. I want the items listed and available for selection to change on one combobox to change based on the item selected on the other.

Hopefully this gives a clearer picture.

And thanks for helping me out with this issue.
Did you found the solution? I got the exact same situation here...

Thank you

W
Feb 16 '07 #4
ambp
1
In order two have two combobox columns that one is based on the previose one you have to do the following:
* Create a global bindingSource
BindingSource filteredCmbColumn2= new BindingSource();
DataView dv = new DataView(dtCmbColumn1);//create a dataview from the first cmbColumn.
filteredCmbColumn2.DataSource = dv;//secend column's datasource is the dataview from first cmbColumn.

In the event: Cell_BeginEdit()
// Set the combobox cell datasource to the filtered BindingSource
DataGridViewComboBoxCell dgcb = (DataGridViewComboBoxCell)datagridview1[e.ColumnIndex, e.RowIndex];
dgcb.DataSource = filteredCmbColumn2;

// Filter the BindingSource based upon the region selected
this.filteredCmbColumn2.Filter = "..."

In the event Cell_EndEdit()
// Reset combobox cell to the unfiltered BindingSource
this.filteredCmbColumn2.RemoveFilter();
Aug 17 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone...
2
by: shumaker | last post by:
I have a combobox that is very much like the one found in the RSS project here: http://msdn.microsoft.com/vstudio/express/visualCSharp/learning/ My projectNameComboBox basically is filled with a...
3
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my...
1
by: Ananthu | last post by:
Hi I have combobox column in datagridview.I have loaded a particular database table column value into it from my mysql database. The combobox in all the rows is filled with my database value...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.