473,507 Members | 2,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3632
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
489
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
1264
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
10732
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
4492
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
1186
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
421
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
1454
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
4784
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
796
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
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7111
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...
1
7031
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
7485
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
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.