I was trying to send a label value form the first form to the label value of the second form, but when I press the button in the first form to open the second form, the label is null, no value pass from the first form to the second form.
Here it is the first form codes:
private void btnFirstForm_Click(object sender, RoutedEventArgs e)
{
SenderClass fl = new SenderClass();
fl.setFLname(lblFLName.Content);
secondForm.Show();
this.Hide();
}
And here it is the class that transfer the value from the first form to second form:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class SenderClass
{
object flName;
public SenderClass() {}
public void setFLname(object flNAME)
{
flName = flNAME;
}
public object getFLname()
{
return flName;
}
}
and here it is the codes of the second form:
private void Grid_Loaded(object sender, RoutedEventArgs e)
{
SenderClass fl=new SenderClass();
lblFLname.Content = "Welcome" + fl.getFLname();
}