In C# I want get the output when I click in the button(Calculate Age ) in the first form give me the output in second form in the label1 how ?? I tried label.Text but it gives me an error
First Form
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void Form1_Load(object sender, EventArgs e)
{
}
public void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
DateTime startTime = Convert.ToDateTime(dateTimePicker1.Value);
DateTime endTime = DateTime.Today;
TimeSpan span = endTime.Subtract(startTime);
var totalDays = span.TotalDays;
var totalYears = Math.Truncate(totalDays / 365);
var totalMonths = Math.Truncate((totalDays % 365) / 30);
var remainingDays = Math.Truncate((totalDays % 365) % 30);
lable1.Text = string.Format("{0} year(s), {1} month(s) and {2} day(s)", totalYears, totalMonths, remainingDays);
}
public void button1_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.Show();
}
}