473,570 Members | 2,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to put several ComboBox in a DataGridView

Ang
HI,

I want to put several DataGridViewCom boBox (which map their own
datatable) into a DataGridView. Different Rows of DataGridView will load
their own DataGridViewCom boBox.
is it possible to do so?
// blockList, cSubjectGroupLi st, subjectGroupLis t are DataTable

foreach (DataRow blockRow in blockList.Rows)
{
DataGridViewCom boBoxColumn column = new DataGridViewCom boBoxColumn();
column.DataSour ce = cSubjectGroupLi st;
column.ValueMem ber =
subjectGroupLis t.Columns["Subject_Gr oup"].ToString();
column.DisplayM ember =
subjectGroupLis t.Columns["Subject_Gr oup"].ToString();
column.Name = blockRow["Block"].ToString();

dataTable1.Colu mns.Add(blockRo w["Block"].ToString());

column.DataProp ertyName = blockRow["Block"].ToString();
dataGridView1.C olumns.Add(colu mn);
}

dataGridView1.D ataSource = dataTable1

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #1
1 1355
On Tue, 29 Apr 2008 02:36:26 -0700, Ang wrote:
HI,

I want to put several DataGridViewCom boBox (which map their own
datatable) into a DataGridView. Different Rows of DataGridView will load
their own DataGridViewCom boBox.
is it possible to do so?
// blockList, cSubjectGroupLi st, subjectGroupLis t are DataTable

foreach (DataRow blockRow in blockList.Rows)
{
DataGridViewCom boBoxColumn column = new DataGridViewCom boBoxColumn();
column.DataSour ce = cSubjectGroupLi st;
column.ValueMem ber =
subjectGroupLis t.Columns["Subject_Gr oup"].ToString();
column.DisplayM ember =
subjectGroupLis t.Columns["Subject_Gr oup"].ToString();
column.Name = blockRow["Block"].ToString();

dataTable1.Colu mns.Add(blockRo w["Block"].ToString());

column.DataProp ertyName = blockRow["Block"].ToString();
dataGridView1.C olumns.Add(colu mn);
}

dataGridView1.D ataSource = dataTable1

*** Sent via Developersdex http://www.developersdex.com ***
I think not. I had same problem which we solved by positioning regular
combo box on datagridview cell dynamically :)
Jun 27 '08 #2

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

Similar topics

4
8623
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...
2
1667
by: Michael D. Reed | last post by:
I have 2 list boxes and a combo box that are bound to table adaptors. I have another table that has relations with the underlying tables to the adaptors above. I have set this up in a dataset. How do I get to this relationship so I can bind a data grid to it? If I have only one list box and a grid, it is provided by intelligence-sense. Is...
8
26398
by: | last post by:
I am sure this has been asked and answered, but here goes anyway... VS.Net 2005, VB.Net How can you display more than one field in the displaymember property of a combobox inside the datagridview control? I am at a loss. Thanks, David
0
1162
by: c_shah | last post by:
I have the controls on my form display the values of the currently selected row of the DataGridView. I am binding my DataGridView to a collection (Collection - which implements IBindingList Interface). I am binding DataGridViewTextBoxColumn to the property of the objects in my collection. I have a combobox that should display a choice of...
3
94228
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
3
14360
by: Przemek M. Zawada | last post by:
Dear Group, I'm developing sample window form, using DataGridView control, which is filled with data through BindingSource, which is based on type of object, as follow: public sampleClass { public int itemNumber; public string itemName;
2
20227
by: David Jackson | last post by:
Hello, I have an unbound DataGridView of which one of the columns is a ComboBox colum containing category data, plus an additional option called <newSo when the ComboBox is dropped down it looks like this <new> First Second Third
0
1679
by: Dom | last post by:
I have a datagridview control, and one column is a ComboboxColumn. I simply create a ComboboxColumn, add items to it, then add the column to the Datagridview control. If I were working with a simple ComboBox, I could capture an event that fired everytime the selected item changed. Is that possible if the DatagridView control? I've...
0
1386
by: HDI | last post by:
Hi, I'm using vb.net express 2005 and I've got a project where I use a datagridview with a combobox in the first column. Depending on the value the user selects I have to set values of other cells. The problem is that I get the selected value when the datagridview isn't in edit mode. First I have to select another cell.
0
7732
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...
0
7638
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...
0
7956
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. ...
1
7703
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...
0
6336
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...
1
5523
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...
0
5247
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...
1
2136
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
0
974
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...

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.