I made a composite control from a maskedtextbox and a datetimepicker to make it easier for a user to enter a date with the keyboard. I also added a property to bind the dtp on the composite control to the bindingsource on my windows form (see below). I also set up a property to return the dtp vlaue. Without explicitly calling the value property and setting the correct data table column to this value, how do I get the value back to the form. I can use the code in the second block below but it seems like I should be able to bind this composite control and not have to call the value property. If I don't do it this way the form never sees the value set in the composite control. Must be a better way. Do I have to bind using a different method? Any suggestions? I would like it to behave like a normal datetimepicker.
Auguy
Sylvania/Toledo Ohio
Code:
'Property in Composite Control
Public Property propBindingSource() As BindingSource
Get
Return (bs)
End Get
Set(ByVal value As BindingSource)
bs = New BindingSource
bs = value
dtpDate.DataBindings.Add("Text", bs, "InvoiceDate")
End Set
End Property
Code:
'Code in Form to Get the Value
dt.Rows(0).Item("InvoiceDate") = MyDateTimePicker1.propValue
Auguy
Sylvania/Toledo Ohio