By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

Errors and Data Binding

P: n/a
I am designing a Windows Form application that binds controls to public properties in a component class. For instance, a DateTimePicker control has its value property bound to the component's CourtDate property. If the passed date is invalid I need to throw an execption to notify the client that they chose an incorrect date/time. The problem is that when the execption is thrown in the component the client receives no error notification or I don't know what to do catch it. Any suggestions?

Example:
In the form:
Me.dtpCourtDate.DataBindings.Add(New Binding("Text", oJuror, "CourtDate"))
In the component:
Public Property CourtDate() As DateTime
Get
Return strcJuror.CourtDate
End Get
Set(ByVal Value As DateTime)
Dim dCheck As DateTime
Try
dCheck = Format(Value, "MM/dd/yyyy hh:mm:ss")
If not dCheck < Today Then
Throw New Exception("Court date must be today's date or greater.")
exit property
End If
Catch ex As Exception
Throw New Exception("Date value is incorrect.")
End Try

Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.