473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Problem with BringToFront()

BringToFront() has the desired effect in my app if the notify icon's
(system tray icon's) context menu is used. However, I can't
BringToFront() in response to a Click event handler.

Here's the code:

private void showContextMenuItem_Click(object sender,
System.EventArgs e)
{
DoShow(); // BringToFront() in DoShow() will work here.
}

private void notifyIcon_Click(object sender, System.EventArgs e)
{
DoShow(); // BringToFront() in DoShow() DOES NOT work here.
}

private void DoShow()
{
Show();

if (WindowState == FormWindowState.Minimized) {
WindowState = FormWindowState.Normal;
}
BringToFront();
}

Anyone have an idea?
Jul 21 '05 #1
1 3625
C# Learner <cs****@learner.here> wrote:

<snip>

Fixed it! Here's the new DoShow() method that works:

private void DoShow()
{
if (WindowState == FormWindowState.Minimized) {
WindowState = FormWindowState.Normal;
}
Activate();
}
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jabailo | last post by:
I launched a form set to an object called Search, from a main form, like this: Search.Show(); Search.Activate(); Search.BringToFront(); But the form stays behind the main form.
0
by: Kathy D | last post by:
I would like to know if there is something like a BringToFront for the minimize button. I have four four child forms on a parent form and when I minimize them the "box" goes behind another...
1
by: C# Learner | last post by:
BringToFront() has the desired effect in my app if the notify icon's (system tray icon's) context menu is used. However, I can't BringToFront() in response to a the notify icon's Click event...
2
by: Eric Goforth | last post by:
Hello, I have an MDI VB.NET app that is called from a VB6 app, and it basically lives on top of the VB App. When the user clicks on controls on the VB6 app I do an MDIParentForm.WindowState...
4
by: sympatico | last post by:
hello to all i got some problem with child forms in my vb.net application. in my application i need to maximize some child forms when they are loaded (set the windowstate to maximized at design...
1
by: C# Learner | last post by:
BringToFront() has the desired effect in my app if the notify icon's (system tray icon's) context menu is used. However, I can't BringToFront() in response to a Click event handler. Here's the...
2
by: squigster | last post by:
Hello Everyone, I am having a problem when I pass a control to a routine and I want to set properties for the control I cannot determine a way to retrieve the passed in controls index so that I...
20
by: vitorjol | last post by:
Hello. I have 2 forms (Form1 and Form2). When i call the Sub placed in form1 from form2, i get the error "object reference not set to an instance of an object" ! What can i do to solve the...
0
by: Porkie999 | last post by:
hi i have created a browser and i wanted 2 know how i can make my browser show a disconnected if a page fails 2 load. Basically i know the code to show the disconnected error however i dont know...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.