Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb.net 2008: Hosting datetimepicker control in datagridview help

Status
Not open for further replies.

rw409168

Programmer
Jul 16, 2009
95
GB
Greetings,

I have created a datatimepicker control in a datagridview (via which functions fine and has a mindate and maxdate set.

I want to adapt this for a datetimepicker with format HH:mm.
I have done this and it functions to a degree.

However if I tried to add the mindate/maxdate the error occurs Exception has been thrown by the target of an invocation." when editing the control

Small section of code regarding editing is
Code:
Class TimeEditingControl

    Inherits DateTimePicker
    Implements IDataGridViewEditingControl
 
    Private dataGridViewControl As DataGridView
    Private valueIsChanged As Boolean = False
    Private rowIndexNum As Integer


    Public Sub New()

        Me.Format = DateTimePickerFormat.Time
        Me.MinDate = New Date(Now.Year, Now.Month, Now.Day, 8, 0, 0)
        Me.MaxDate = New Date(Now.Year, Now.Month, Now.Day, 17, 0, 0)

    End Sub

Full code for the control is
Can anyone please assist Im out of my depth when creating such a complex control, im drowning!! :-(

Thanks
Rob
 
I have resolved this issue now, applying MinDate and MaxDate to the IDataGridViewEditingControl.ApplyCellStyleToEditingControl.

Working as intended, now.

Happy :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top