Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Questions about date types
Message
 
À
10/02/2006 14:08:47
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01095526
Message ID:
01096059
Vues:
13
Dave,

>I have a coulpe of questions about using dates in VS2005 and MM.NET. I am building a Web App very similar to the sample Web App in MM that accesses VFP tables.
>
>1. When I load my edit form, all of the fields where the date is empty (blank), display with 12/30/1899. How do I get them to display blank? Once the user puts a date in and the form is saved, they display the entered date correctly.
>
>2. When the user enters a date in my mmTextBox control, how do I compare and vaildate the entry. In VFP, I would use the CTOD() to see if the entry would return a date or ' / / '. How do I do this in VS2005/MM.NET?
>
>3. Finnally, if the user passes a date that is not valid, I would like to display a simple error message. In VFP, I would use the messagebox(). I did find a mmMessageBox function but could not get it to work.

Regarding the empty date question, are you creating a Web Forms application? The reason I ask is because your second question is about MessageBox() and MessageBox is a Windows Forms class, so it doesn't work on the web.

To convert a date from string to DateTime you can do this:
DateTime.Parse(MyDate);
I recommend checking out the Visual FoxPro Toolkit for .NET. Its help file contains a list of Visual FoxPro commands and shows you the equivalent command in .NET.

Best 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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform