Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Datagridview in windows application
 

Datagridview in windows application

Hi, Whether we can create datagridview like below manner, 1)First column, first row should display image. Second row must display label and third row must display image button. 2)Second column,Label in first row and image button in second row. Both the column should be generated at the runtime.. is this possible?? Give some suggestions to output lik above format in datagridview
sri__pirabaharan  Wednesday, September 30, 2009 10:36 AM
The DataGridView is designed to have ONE style of column. So a column is either a TextBoxColumn or an ImageColumn or a ButtonColumn.

I understand that it is possible to create your own style of column and use it in a DataGridView. I have never done this and don't know if it is possible to create an "ObjectColumn" that would correctly display anything *and* make it work correctly (such as a button click if the button were a column.)

You could look at third party products or sites such as CodeProject to see if anyone has written an alterative type of grid product that you could use for this.

Another option is to consider a FormLayoutPanel or TableLayoutPanel instead of a grid. That gives you much more control over the contents.

Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Wednesday, September 30, 2009 3:39 PM
The DataGridView is designed to have ONE style of column. So a column is either a TextBoxColumn or an ImageColumn or a ButtonColumn.

I understand that it is possible to create your own style of column and use it in a DataGridView. I have never done this and don't know if it is possible to create an "ObjectColumn" that would correctly display anything *and* make it work correctly (such as a button click if the button were a column.)

You could look at third party products or sites such as CodeProject to see if anyone has written an alterative type of grid product that you could use for this.

Another option is to consider a FormLayoutPanel or TableLayoutPanel instead of a grid. That gives you much more control over the contents.

Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Wednesday, September 30, 2009 3:39 PM
Thanks for the reply. Whether we can create separate usercontrol for every column and add it as the column to the datagridview?
SriPirabaharan  Thursday, October 01, 2009 3:43 AM

Hi,

 

You can change the cell dynamically.

See this thread:

http://social.msdn.microsoft.com/forums/en-US/winformsdesigner/thread/63ddb457-f769-44db-87cc-9e88e74929e8/

 

Best regards,

Ling Wang


Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Wednesday, October 07, 2009 11:54 AM

You can use google to search for other answers

Custom Search

More Threads

• Databinding ComboxBox, combo is bounded but behaves like no items present??????
• Print DataGridView
• HELP!!!!unable to save data using window form!!!!URGENT!!!
• Customizing the sortglyph in the datagridview
• data set on combobox
• DataGridView Row with a line underneath.
• how to bring textbox in gridview load
• Tracking DataGridViewComboBoxColumn doublick event
• Datagridview Exception: column does not allow null
• Problem with displaying result.