943,708 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 7877
  • C# RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jan 19th, 2009
0

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

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.
Reputation Points: 25
Solved Threads: 0
Junior Poster in Training
ambarisha.kn is offline Offline
66 posts
since Jun 2008
Jan 19th, 2009
0

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

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 ?
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Jan 19th, 2009
0

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

There is an event like Activated. You can try that event.
private void Form1_Activated(object sender, EventArgs e)
{
//code
}
Reputation Points: 12
Solved Threads: 3
Newbie Poster
bhaskerlee is offline Offline
19 posts
since Dec 2008
Jan 19th, 2009
0

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

Dude this works

C# Syntax (Toggle Plain Text)
  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.
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Jan 19th, 2009
0

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

Hold on ... not yet ... i will be with you now
cVz
Reputation Points: 29
Solved Threads: 7
Junior Poster
cVz is offline Offline
139 posts
since Mar 2008
Jan 19th, 2009
0

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

if we use activate event, it will go infinite. not able to minimize of form1 or close of form1.
Reputation Points: 25
Solved Threads: 0
Junior Poster in Training
ambarisha.kn is offline Offline
66 posts
since Jun 2008
Jan 25th, 2009
0

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

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

C# Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
xmen_xwk is offline Offline
3 posts
since Apr 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: time complexity
Next Thread in C# Forum Timeline: can C# perform command prompt lines





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC