public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { DateTime Datecourante = DateTime.Now; DateTime Datenaissance = new DateTime(textBox3.Text); label3.Text = (Datecourante) - (textBox3.text); TimeSpan Ts = Datecourante - Datenaissance ; Form2 frm = new Form2(Ts); frm.Show(); }
public partial class Form2 : Form { public Form2(DateTime Ts) { InitializeComponent(); label1.Text = Ts; }
TimeSpan Ts = Datecourante - Datenaissance ;
public Form2(DateTime Ts)
Mais ca ne marche pas
private void button1_Click(object sender, EventArgs e) { InitializeComponent(); DateTime Datecourante = DateTime.Now; DateTime Datenaissance = new DateTime(); label3.Text = (Datecourante) - (textBox3.text); TimeSpan Ts = Datecourante - Datenaissance; Form2 frm = new Form2(label3.Text); frm.Show(); }
public partial class Form2 : Form { public Form2(TimeSpan Ts) { InitializeComponent(); label1.Text = (Convert.ToString(Ts)); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDateTime dt = DateTime.ParseExact("20101201", "yyyyMMdd", null );
l'utilisateur doit rentrer sa date de naissance.