views:

13

answers:

0

I am using the following aproach to add a calendar control to a WinForm DataGridView.

http://msdn.microsoft.com/en-us/library/7tas5c80.aspx

Dim colReceived As New CalendarColumn()
grdVisa.Columns.Add(colReceived)

'Loop through rows r, accessing calendar column c
Dim CurrentCell As CalendarCell = CType(grdVisa.Rows(r).Cells(c), CalendarCell)

If CurrentChinaVisa.ReceiveDate.IsNull Then ' CurrentChinaVisa.ReceiveDate is defined as SqlDateTime 
   'I want to set the DateTimePicker checked property to False
   'I would also like to consider hiding the DateTimePicker control entirely for the curr cell.
Else
    CurrentCell.Value =  CurrentChinaVisa.ReceiveDate.Value
End If

I would like to hide/show the Calendar based up the selection of a combobox in anotehr column.

How do I do this?

How do I get access to the DateTimePicker?

I took a wild guess at it:

                    Dim CurrentCell As CalendarCell = CType(grdVisa.Rows(r).Cells(c), CalendarCell)

                    CurrentCell.Selected = True
                    Dim DateTimePicker As DateTimePicker = CType(grdVisa.EditingControl, DateTimePicker)

                    If CurrentChinaVisa.ReceiveDate.IsNull Then
                        DateTimePicker.Checked = False
                    Else
                        DateTimePicker.Checked = True
                        CurrentCell.Value = Now ' 
                    End If

but the "DateTimePicker" was Nothing.