We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,379 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Passing data between forms in c#

hey, I have created two forms. in one form there is a panel, which is
Form1:

Panel1.visibel = false;

Form2: When the

WindowState == FormWindowState.Minimized

then the panel1 in form1 needs to be visible, but how to do that ? :S

Waleed Ahmed

3
Contributors
12
Replies
2 Days
Discussion Span
1 Year Ago
Last Updated
13
Views
eoop.org
Junior Poster
108 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

change the "Modifiers" property of the panel of Form1 to "protectedinternal" so that it can be accessible from Form2

cool_zephyr
Junior Poster in Training
87 posts since Apr 2009
Reputation Points: 5
Solved Threads: 10
Skill Endorsements: 0

Ok, next...
what is the code i need to use ? :S

eoop.org
Junior Poster
108 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

in the FormWindow.Minimized condition
-Form1.panel1.visible=true

cool_zephyr
Junior Poster in Training
87 posts since Apr 2009
Reputation Points: 5
Solved Threads: 10
Skill Endorsements: 0

check if the Form2 is minimized
-if yes, Form1.panel1.visible=true;

cool_zephyr
Junior Poster in Training
87 posts since Apr 2009
Reputation Points: 5
Solved Threads: 10
Skill Endorsements: 0

It is not working :S
plizz help :)

eoop.org
Junior Poster
108 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

did you set the "modifiers" property of panel1 to "protected internal" in the property box???

cool_zephyr
Junior Poster in Training
87 posts since Apr 2009
Reputation Points: 5
Solved Threads: 10
Skill Endorsements: 0

Yes i did, this is the code i inserted in the form2 :)

if (this.WindowState == FormWindowState.Minimized)
            {
                Form1 dlg = new Form1();
                dlg.panel7.Visible = true;
            }

this code is in form2_Load

eoop.org
Junior Poster
108 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

first you have to show the form then only the panel will be visible i guess

Form1 dlg = new Form1();
dlg.Show();
dlg.panel7.Visible = true;
cool_zephyr
Junior Poster in Training
87 posts since Apr 2009
Reputation Points: 5
Solved Threads: 10
Skill Endorsements: 0

Nope, the both forms are running. i dont make any of the form visible = false :)
plizz help :)

eoop.org
Junior Poster
108 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Try this:

dlg.panel7.Visible = true;
dlg.panel7.BringToFront();
vadriaan
Light Poster
35 posts since Jul 2010
Reputation Points: 7
Solved Threads: 2
Skill Endorsements: 0

Do i need to use an if statement ?
and if i need to how would it be like and where to put it. I dont think the code i am using is right in the form_load function

eoop.org
Junior Poster
108 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Without an IF statment:

WindowState == FormWindowState.Minimized
dlg.panel7.Visible = true;
dlg.panel7.BringToFront();

or with it:

IF (WindowState.IsMinimized)
{
   dlg.panel7.Visible = true;
   dlg.panel7.BringToFront();
}
vadriaan
Light Poster
35 posts since Jul 2010
Reputation Points: 7
Solved Threads: 2
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0899 seconds using 2.69MB