Hi,
I have two forms. there is a listBox in form1 and I need to add to this listBox from FORM2.
It is not too hard, but I may need to add an item to another form's listBox.
I mean maybe I will have a third form witch contains a listBox and I must add the item form FORM2 into that listBox.
I hope I could explain curefully.
Please Help
Thanks
Access a form from other forms
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
jason4 pointsPosted Jul 26, 2009, 5:50 PM EDT
H Ghasemi7 pointsPosted Jul 27, 2009, 6:08 AM EDT
Jason13 pointsPosted Jul 28, 2009, 7:42 AM EDT
Program
{
public static Form1 f1;
public static Form2 f2;
public static Form3 f3;
public static Form4 f4;
}
and then assign those values on form load
Form1
{
OnFormLoad()
{
Program.f1 = this;
}
}
You can then access the form members across the whole application. This opens you up to threading issues though, so beware.