473,666 Members | 2,258 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 showContextMenu Item_Click(obje ct sender,
System.EventArg s e)
{
DoShow(); // BringToFront() in DoShow() will work here.
}

private void notifyIcon_Clic k(object sender, System.EventArg s 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 3667
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
1280
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 window. The design of the form doesn't allow me to change the size of the window that the minimize hides behind. Can I bring the minimized box to the front?
1
10745
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 handler. Here's the code: private void showContextMenuItem_Click(object sender, System.EventArgs e) { DoShow(); // BringToFront() in DoShow() will work here.
2
4506
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 = FormWindowState.Minimized After the user has clicked on a particular menu item then I want to bring my VB.NET MDI app back on top. I've tried
4
1195
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 time). if i do so then, the next form opened which is not be maximized and the windowstate is also set to "normal" at design time also getting maximized (awwwwww it sucks). why this happens so ?. (i guess its setting the prev. forms window...
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 code: private void showContextMenuItem_Click(object sender, System.EventArgs e) { DoShow(); // BringToFront() in DoShow() will work here.
2
1467
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 can set the properties for the specific index. The routine blows up after the first time through. The If idx = statement is screwed up. Any help would be appreciated. Thanks, Jim My code is as follows:
20
4798
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 problem? Thanks
0
802
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 how i can tell vb.net that the internet page failed to load. CODE: Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ToolStripStatusLabel1.Text = ("")
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8550
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7385
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5663
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
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 we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.