Hi,
i do have 2 Forms. Form1 and Form2. Form2 is called by Form1 (button click).
On Form2 i have a WPF UserControl. This User control has a Textbox on it (Mytext).
Now i am creating 2 instances of Form2 from Form1 (by button click).
I am Naming both Form2 instances differently "FormNr2" and "FormNr3".
Now i want to call the TextChange() Method i have on the WPF UserControl that
is running on Form2 instance Called "Form3".
So first i will identify the Form3 by its Name and i will access a Method on this
Form3 that is called ChangeTextinUserControl();
---------------------------------------------------------------------------------
Form1 .....
if (System.Windows.Forms.Application.OpenForms["FormNr3"] != null)
}
(System.Windows.Forms.Application.OpenForms["FormNr3"] as
ChangeTextinUserControl();
}
---------------------------------------------------------------------------------
Form2 ......
public void ChangeTextinUserControl()
{
UserControl1 UC = new UserControl1();
UC.TextChange();
}
Here i do get the problem that i have to make an object because i cant access
the TextChange() method directly (non static error).
---------------------------------------------------------------------------------
UserControl1 .......
public void TextChange()
{
Mytext.Text = "This is an new Text";
}
Well when i run my code i will get no errors, but also my Textbox on the Usercontrol of Form3 is not changing. I guess because i made a new instance of the UserContorl and told this one to start the TextChange() Method and not the running
instance that is currently on Form3. Someone knows how to access this WPF UserContorl instance on Form3?
Thanks,
Hank