Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ImmBinding interface implementation
Message
 
To
22/12/2003 15:03:53
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00860193
Message ID:
00861654
Views:
29
Nathan,

>Now I'm working on a DataPicker control that can handle System.DBNull. The .Net DateTimePicker works fine with intitialized dates, but when adding new records, and there's date columns in the dataset that do not get intialized to a specific date, that control blows up trying to bind. I miss VFP's empty date, which I guess SQL doesn't have. Any suggestions there?

You can override the DatePicker's Value property like this:
/// <summary>
/// Value property
/// </summary>
public new object Value
{
	get { return base.Value; }
	set 
	{
		if (value is DateTime)
		{
			base.Value = (DateTime)value;
			this.Checked = true;
		}
		else if (value == DBNull.Value)
		{
			this.Checked = false;
		}
		else
		{
			throw new ArgumentException(
				"Argument must be a DateTime or DBNull.Value");
		}
	}
}
I'll be adding this to the mmDatePicker class, but in the interim you can add this to your subclass of mmDatePicker.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Reply
Map
View

Click here to load this message in the networking platform