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.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
JivlainPosted Apr 22, 2006, 5:39 AM
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