Hi,
I would like to know how I can pass a value, that was arrived at by calculating two double values in two different text boxes of a form form1 to a method of a different form form2.
Passing control values - some suggestions
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Jivlain14 pointsPosted Apr 22, 2006, 1:39 AM EDT
public void stuff(double val)
{
MessageBox.Show(val.ToString()); //whatever processing you want here
}
The key here is the "public" keyword at the start of the function declaration. This means methods in other classes (that is, classes outside the form, can call the function.
in some method on form 1 (like a button for example):
Form2 frm2=new Form2(); //create the new form
frm2.stuff(1.7); //call the function on form 2. replace the 1.7 with whatever double variable