Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
How can I add items to an already existing combobox cell in a datagridview combobox column ,
Each row contains a different items in the combobox column ,
I want to add the items to the specific combobox cell of a specific row ,
I tried something like this but it didn't work :
 
dataGridView1.Rows[0].Cells[2].Items.Add();
 
Thank you .
Posted 18-Jan-11 1:22am
Edited 19-Jan-11 22:46pm
v4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

DataGridViewComboBoxColumn colType = new DataGridViewComboBoxColumn(); 
colType.HeaderText = "Type"; 
colType.DropDownWidth = 90; 
colType.Width = 90; 
colType.MaxDropDownItems = 5; 
this.dataGridView1.Columns.Insert(7, colType); 
colType.Items.AddRange("A", "N", "P", "S", "Z"); 
this.dataGridView1.Columns[7].DataPropertyName = "trans_type";
 

this can help may be
  Permalink  
Comments
Michael Waguih at 18-Jan-11 7:41am
   
Sorry I need a code for an already existing column each row combobox cell contains different items Thanks
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

use this link
 
http://homepage.ntlworld.com/herring1/datagrid.html
  Permalink  
Comments
Michael Waguih at 20-Jan-11 3:36am
   
This link help me to create a new column with the same items in all cells of this column . but I need a way to add items in specific cell of a specific row , Thanks
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I need a way to add items in specific cell of a specific row in the combobox column of a datagridview ,
Can anyone help me.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 838
1 OriginalGriff 461
2 Tadit Dash 355
3 sanket saxena 329
4 Peter Leow 228
0 Sergey Alexandrovich Kryukov 12,109
1 OriginalGriff 7,326
2 Peter Leow 5,003
3 Abhinav S 4,003
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web03 | 2.8.140421.2 | Last Updated 20 Jan 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid