Click here to Skip to main content
15,895,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, I want to add the Panel control into dataGridView cell, And there is no such column. So I want to create a column that made up with a panel in dataGridView,
Please help me

thank you
Posted
Comments
Rojalin Sahoo 14-Sep-15 0:48am    
create panel object (Panel panelid = new Panel();) and add that to datagridview using this.datagridview1.Controls.Add(panelid);
Sinisa Hajnal 14-Sep-15 3:28am    
I think it should be: datagridview1.columns(your_column).control.add(panelId);

Why do you need it? Maybe there is a better way?
Rojalin Sahoo 14-Sep-15 4:03am    
we can use datagridview1.columns(your_column).control.add(panelId); // if want to add to an existed cell

this.datagridview1.Controls.Add(panelid); // this is used to add created control to the control collection of datagridview then we can set its location and size using DataGridView.GetCellDisplayRectangle Method
Sinisa Hajnal 14-Sep-15 7:18am    
Yes...but wouldn't that create only one control instead of number required for the rows?
Rojalin Sahoo 15-Sep-15 3:25am    
yes.But there is some way out like we can use foreach row loop or in databound and set the location as per loop/row.

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