Faire un controle sur les dates en C#.net

Fermé
manue514 - 29 avril 2009 à 13:30
 zorro - 29 avril 2009 à 15:53
Bonjour,

je souhaiterais faire un contrôle sur les dates saisies en entrées de facon à ce qu'elles respectent un certain format : JJ/MM/AAAA

Je ne sais comment le programmer, voici un bout de mon code pour la saisie de la date :

// t_datefin

this.t_datefin.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.t_datefin.Location = new System.Drawing.Point(328, 40);
this.t_datefin.Name = "t_datefin";
this.t_datefin.Size = new System.Drawing.Size(90, 20);
this.t_datefin.TabIndex = 15;
this.t_datefin.Text = "";
this.infobulle.SetToolTip(this.t_datefin, "Date de fin de l\'affaire.");

Merci pour votre aide
Manue
A voir également:

1 réponse

Voilà comment formater un champs date!


// Format : 07 / 03 / 2004
formattedDate = DateTime.Now.ToString("dd / MM / yyyy");

solution trouvé ici :
https://www.dotnetspider.com/resources/266-Formatting-Date-Time-using-e-DateTime-object.aspx
0