Create a delegate and an event in your second form, then subscribe to the event in the main form.
In second form class:
public delegate void UpdateCalculation(object sender, double value);
public event UpdateCalculation OnUpdateCalculation;
Actually this is the preferred way
public class CalculationEventArgs : EventArgs
{
CalculationEventArgs(double _value)
{
CalculatedValue = _value;
}
double CalculatedValue { get; set; }
}
public delegate void UpdateCalculation(object sender, CalculationEventArgs e);
public event UpdateCalculation OnUpdateCalculation;
In some method in your second form
void SomeMethod()
{
if (OnUpdateCalculation != null)
OnUpdateCalculation(this, new CalculationEventArgs(25.0));
}
In main form:
Form2 frm2 = new Form2();
frm2.OnUpdateCalculation += OnUpdateCalculation_fired;