Activate form2 when form1 activates(Back to front)

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2008
Posts: 66
Reputation: ambarisha.kn is an unknown quantity at this point 
Solved Threads: 0
ambarisha.kn ambarisha.kn is offline Offline
Junior Poster in Training

Re: Activate form2 when form1 activates(Back to front)

 
0
  #11
Jan 19th, 2009
I have mentioned so many times, minimize and maximize is not a aproblem for me.

I already wrote this code for minimize and maximize of both forms and working fine, but the problem is as follows.

Form1 and form2 both in normal mode.
if i click on 3rd window, both form1 and form2 will go behind that 3rd window.

Again if i want to see form1 and form2, i have to click on form1, so that both forms have to come front of third window and have to visible of both form1 and form2.

I hope u understood my question.
Ambarish
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 136
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

Re: Activate form2 when form1 activates(Back to front)

 
0
  #12
Jan 19th, 2009
So do you want them to ALWAYS be on top ?? kind of like Windows live ?? or do you want them both to show if you click on form1 ?
Delphi & C# programmer deluxe...
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 17
Reputation: bhaskerlee is an unknown quantity at this point 
Solved Threads: 2
bhaskerlee bhaskerlee is offline Offline
Newbie Poster

Re: Activate form2 when form1 activates(Back to front)

 
0
  #13
Jan 19th, 2009
There is an event like Activated. You can try that event.
private void Form1_Activated(object sender, EventArgs e)
{
//code
}
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 136
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

Re: Activate form2 when form1 activates(Back to front)

 
0
  #14
Jan 19th, 2009
Dude this works

  1. private void Form1_Activated(object sender, EventArgs e)
  2. {
  3. Form2 F2 = new Form2();
  4.  
  5. F2.ShowDialog(); // Puts it on top (form1 wont be accessible)
  6. F2.Show(); // Makes form 1 accessible
  7. }

Hope that helps
Last edited by cVz; Jan 19th, 2009 at 5:47 am.
Delphi & C# programmer deluxe...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 136
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

Re: Activate form2 when form1 activates(Back to front)

 
0
  #15
Jan 19th, 2009
Hold on ... not yet ... i will be with you now
Delphi & C# programmer deluxe...
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 66
Reputation: ambarisha.kn is an unknown quantity at this point 
Solved Threads: 0
ambarisha.kn ambarisha.kn is offline Offline
Junior Poster in Training

Re: Activate form2 when form1 activates(Back to front)

 
0
  #16
Jan 19th, 2009
if we use activate event, it will go infinite. not able to minimize of form1 or close of form1.
Ambarish
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 3
Reputation: xmen_xwk is an unknown quantity at this point 
Solved Threads: 0
xmen_xwk's Avatar
xmen_xwk xmen_xwk is offline Offline
Newbie Poster

Re: Activate form2 when form1 activates(Back to front)

 
0
  #17
Jan 25th, 2009
i had that same problem and that made me very crazy when i select any window and select my form the another form kept back to that window but i sort that out


here is the code, mark this thread Solved

  1. bool IsJustActivated = false;
  2. private void Xform_Activated(object sender, EventArgs e)
  3. {
  4. if (!IsJustActivated)
  5. {
  6. IsJustActivated = true;
  7. BackForm.Activate();
  8. bool tmp_holdValue = this.TopMost;
  9. this.TopMost = true;
  10. this.TopMost = tmp_holdValue; //this.Activate() wont work
  11. }
  12. else
  13. IsJustActivated = false;
  14. }
Last edited by xmen_xwk; Jan 25th, 2009 at 12:54 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum


Views: 3206 | Replies: 16
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC