Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ImmBinding interface implementation
Message
 
À
22/12/2003 15:03:53
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00860193
Message ID:
00861654
Vues:
28
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform