Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I display a DateTimePicker in a DataGridView?

Tags:

Is there any way to put a DateTimePicker control in the DataGridView?

I checked all the possible properties but it give option of checkbox, combo box etc, but not the DateTimePicker.

like image 677
Furqan Sehgal Avatar asked Jan 27 '11 11:01

Furqan Sehgal


1 Answers

You haven't missed any built-in option, but it is possible to subclass both the DataGridViewColumn and DataGridViewCell classes to host any control of your choosing.

This article on MSDN explains the process in more detail, and even includes some sample code:
How to: Host Controls in Windows Forms DataGridView Cells

You can also find a complete sample on Code Project: Generic DataGridView V2.0

like image 111
Cody Gray Avatar answered Oct 12 '22 04:10

Cody Gray