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 th
Ok... Using some of @rajat and @Aaron examples, i made one that pops up on the DateTimePicker cell. Thanks everyone.
Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
If e.ColumnIndex = 8 Then 'CHECK IF IT IS THE RIGHT COLUMN
'SET SIZE AND LOCATION
Dim rect = DataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, True)
DateTimePicker1.Size = New Size(rect.Width, rect.Height)
DateTimePicker1.Location = New Point(rect.X + 10, rect.Y + 76) 'USE YOU OFFSET HERE
DateTimePicker1.Visible = True
ActiveControl = DateTimePicker1
End If
End Sub
Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
If DataGridView1.RowCount > 0 Then 'JUST TO AVOID FORM LOAD CRASH
DataGridView1.CurrentCell.Value = DateTimePicker1.Value.ToShortDateString
DateTimePicker1.Visible = False
End If