Click here to Skip to main content
15,895,784 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my Datagrideview contains 4 cloumns and 5 rows.
all cells are textbox type

i want to change type of cell at cloumns(3) row(2) from textbox to combobox


this is link to picture what i want

from here.

my project in vb.net
and databse access 2003

thank you .

What I have tried:

when i search i found code add all cloumns i dont need that
Posted
Updated 4-May-16 6:12am
v3
Comments
CHill60 4-May-16 11:06am    
I don't think that it is possible to add a combobox to a single cell - you can have a comboBox column on the DGV. If you want it on a single cell then you are going to have to write a usercontrol
Member 12439771 4-May-16 11:23am    
thank you
OriginalGriff 4-May-16 11:13am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Perhaps if you explain in more detail, and maybe give us an example?
Use the "Improve question" widget to edit your question and provide better information.
Member 12439771 4-May-16 11:24am    
ok i will send picture
OriginalGriff 4-May-16 11:34am    
No, don't send a picture: describe it!
You can't post pictures in questions, and very few people here will follow "random" links!

1 solution

I have no idea if this will work in your system, but...
C#
DataGridViewComboBoxCell myCell = new DataGridViewComboBoxCell();
myCell.Items.AddRange("Hello", "there", "world");
myDataGridView.Rows[2].Cells[3] = myCell;
Will do it.
However, depending on the source for your existing data, you may get DataError exceptions.
 
Share this answer
 
Comments
Member 12439771 4-May-16 12:23pm    
i edit the code to visual basic

Dim myCell As New DataGridViewComboBoxCell()
myCell.Items.AddRange("Hello", "there", "world")
DataGridView1.Rows(2).Cells(3) = myCell

and when i run view error massage
OriginalGriff 4-May-16 13:58pm    
What error message?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900