hi Nadir
Follow this.
in the form1 class declare put this statement.
public static Form1 staticVar = null;
i.e it shoudl look like the code below
public class Form1 : System.Windows.Forms.Form
{
public static Form1 myform1 = null;
................ otther code....
assuming that you are trying to open form2 in a button click event in Form1
... write the following code (openform2 is a button in form1)
private void openform2_Click(object sender, System.EventArgs e)
{
myform1 = this;
Form2 form2 = new Form2();
form2.Show();
}
Now in Form2 you can refer to this static Variable in teh following way
assuming you want to set teh caption of Form1 in a button click event in
Form2. (changeForm2Caption is a button in form2)
private void changeForm2Caption_Click(object sender, System.EventArgs e)
{
Form1.myform1 .Text = "test";
}
The above code will change the caption of form1.
hope this helps
cheers
pradeep TP
"nadir b" wrote:
hi
I don't know how to change for exemple a form1 caption text from form2
don't forget that form2 has created from form1
I want sample code with c#
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!