a new form problem

guest31ro

Member
Joined
May 17, 2003
Messages
21
I have to forms (2 diferent clases) and one object, I need that object in the bougth forms. How do I do that?

If I declare that object in the first form, how do I see it in the second?

Thanks.
 
Last edited by a moderator:
for exapmle I have something like this:

public class Form1:form
{
......
static void Main()
{
Form1 FormN = new Form1();
Application.Run(FormN);
}
.....
private void top()
{
FormN.Size = new Size(30;56);
}
}

I would like to use the FormN in a new form but if I declare it outside the main, I can not see it in main, and if I declare it in main I con not see it outside the main.
What should I do?
 
you could overload constructor of your "other Forms" and then you can pass FormN as parametar!!
 
Last edited by a moderator:
I have to forms (cass-es)
Form A and Form B

The problem is that I nedd to modify something from Form B in Form A, and olso I need to modify something form Form A in Form B.

What should I do? Any sugestion?

Thanks.
 
If you declare the variables that hold your forms as public, then you can access them from anywhere in your application.
 
If FormA created FormB you need to use static variables in FormA for FormB to access them. From FormB you will need to use
FormA.YourStaticVariable=10;
 
Back
Top