473,803 Members | 2,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

6 New Member
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 4080
Luceafaru
12 New Member
This may help:

http://www.thescripts. com/forum/post2081478-2.html
Sep 8 '06 #2
svaradan
6 New Member
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
WereWolfx
1 New Member
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 New Member
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 filteredCmbColu mn2= new BindingSource() ;
DataView dv = new DataView(dtCmbC olumn1);//create a dataview from the first cmbColumn.
filteredCmbColu mn2.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
DataGridViewCom boBoxCell dgcb = (DataGridViewCo mboBoxCell)data gridview1[e.ColumnIndex, e.RowIndex];
dgcb.DataSource = filteredCmbColu mn2;

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

In the event Cell_EndEdit()
// Reset combobox cell to the unfiltered BindingSource
this.filteredCm bColumn2.Remove Filter();
Aug 17 '08 #5

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

Similar topics

4
8645
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 tell me if this is even possible, and if so, how to do it? If this is completely impossible, how would you suggest going about sorting a ComboBox wherein the text displayed in the column is the client's name, and the underlying value is an ID? ...
2
8674
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 list of values from a table, and as the user selects values, a datagrid displays related records from another table because it is bound via FK relationship. My table: /****** Object: Table . Script Date: 06/19/2006
3
94276
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 database. For example: table JobTypes 1 | Manager 2 | Controller 3 | Supervisor table Employee
1
2486
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 successfully.But i am unable to select values from it. And my second problem is I am unable to retrieve the penultimate row values in datagridview before the new row which is automatically generated.The error for it is nullpointerexception. But i...
0
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
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
10317
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9127
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6844
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();...
1
4277
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
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2974
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.