473,770 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display a notification form on top of the main form?

I have a separate thread that handles data transfer operations (with a mobile
device). I've set things up so that a small notification form is displayed
in the lower right corner of the window. This all works fine.

But what I can't figure out how to do is to get it to display on top of my
main form, if the main form is maximized. I've tried all of the following:

statusForm = new frmNotify();
statusForm.Show (); // Display Notification Window asynchronously

statusForm.Focu s();
BringWindowToTo p((int) statusForm.Hand le);
SetForegroundWi ndow(statusForm .Handle);

With the last two being API calls. But nothing seems to work. I KNOW that
this notification form will display over top of the main form because I can
do so manually but I can't seem to do so programmaticall y. What am I missing?

--
Robert W.
Vancouver, BC
www.mwtech.com

Nov 17 '05 #1
3 3085
Hi Robert,
I am not sure why you can't get the form to show ontop of your main form,
unless the main form has a proprety like TopMost set to true.

You could set your small form to have it's TopMost property set to true
and see if that helps you, then it will always be ontop of the other form.

Mark.

"Robert W." wrote:
I have a separate thread that handles data transfer operations (with a mobile
device). I've set things up so that a small notification form is displayed
in the lower right corner of the window. This all works fine.

But what I can't figure out how to do is to get it to display on top of my
main form, if the main form is maximized. I've tried all of the following:

statusForm = new frmNotify();
statusForm.Show (); // Display Notification Window asynchronously

statusForm.Focu s();
BringWindowToTo p((int) statusForm.Hand le);
SetForegroundWi ndow(statusForm .Handle);

With the last two being API calls. But nothing seems to work. I KNOW that
this notification form will display over top of the main form because I can
do so manually but I can't seem to do so programmaticall y. What am I missing?

--
Robert W.
Vancouver, BC
www.mwtech.com

Nov 17 '05 #2
Mark,

Coming from the VB6 world, I wasn't aware of the TopMost property. I just
checked and both forms had it set to False. So I set my Notification form's
TopMost property to True and voila, it worked.

Thank you!!!

P.S. I think I need more coffee and less sleep (or is it the other way
around?)

--
Robert W.
Vancouver, BC
www.mwtech.com

"Mark R. Dawson" wrote:
Hi Robert,
I am not sure why you can't get the form to show ontop of your main form,
unless the main form has a proprety like TopMost set to true.

You could set your small form to have it's TopMost property set to true
and see if that helps you, then it will always be ontop of the other form.

Mark.

"Robert W." wrote:
I have a separate thread that handles data transfer operations (with a mobile
device). I've set things up so that a small notification form is displayed
in the lower right corner of the window. This all works fine.

But what I can't figure out how to do is to get it to display on top of my
main form, if the main form is maximized. I've tried all of the following:

statusForm = new frmNotify();
statusForm.Show (); // Display Notification Window asynchronously

statusForm.Focu s();
BringWindowToTo p((int) statusForm.Hand le);
SetForegroundWi ndow(statusForm .Handle);

With the last two being API calls. But nothing seems to work. I KNOW that
this notification form will display over top of the main form because I can
do so manually but I can't seem to do so programmaticall y. What am I missing?

--
Robert W.
Vancouver, BC
www.mwtech.com

Nov 17 '05 #3
If you need the notification form to display over all open windows, you
can set the TopMost property of the form to true
statusForm.TopM ost=true;

If you just need the notification form to display just over your main
form whenever your main form is in view, then you need to set the Owner
property of your notification form.

statusForm.Owne r=mainForm;
// OR
mainForm.AddOwn edForm(statusFo rm);

However, keep in mind that when a form is owned by another form, it is
minimized and closed with the owner form. For example, if Form2 is
owned by form Form1, if Form1 is closed or minimized, Form2 is also
closed or minimized.

Sarin.

Nov 17 '05 #4

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

Similar topics

0
8375
by: grutta | last post by:
I am writing a windows service that will recieve notification when a USB Device is insterted into the machine. I have used the RegisterDeviceNotification and the RegisterServiceCtrlHandlerEx with a handler. The handler portion seems to fail indicating that my parameters are invalid. I am getting an error code 126 when i try to register the handler and 28 when i register for event notification. Any ideas as to what the deal is? I am...
1
1907
by: iggie | last post by:
Hello, everyone. How can I display text from another form that currently has the focus. I'm doing a search in sql 2000, to dot it. I call a search form and query my criteria, when it founds the value a display this on a list view. Next, when the user selects the row, I want that to display the information on the main form.
9
31246
by: yezanxiong | last post by:
Hello all, I am new in asp.net developer,I would like to ask a simple question. how to display a message box in web application using asp.net? If I just use Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click MsgBox("please enter the correct user name and password",
1
1829
by: Johnfcf | last post by:
I have a database consisting of 3 tables, the main table with main contact info, a second table with additional address info and a third table consisting of additional contact information, or more specifically 'other names sometimes used to identify the main contact person'. I have related the tables, the main contact info table being the main table on the one side, and the other two tables hold additonal data and are on the many side.
2
2212
by: N. Graves | last post by:
Thanks for your help and reading my note! I would like to display an image that would let the user know that more information was stored in a comments field. If the comments field is empty I don't want to display the image. If/when I get this working then I will let the user click on the image to open up another form of the comments field. Let me know if you have any suggestion please.
11
4663
by: bala | last post by:
hi!!! i need to display a disclaimer which is two page in length in a word document. i also need to format the text. the idea is something as follows on opening the application, a form which serves as splash screen with the disclaimer of the application is shown. now the problem i am running into is in the display of the disclaimer which is really two page long and it should be formatted too. using a textbox seems not
0
1370
by: yasker | last post by:
Hi, I got a problem in display a sub form. My app contains two form: main and sub. I want sub form display before main form, to provide some information to it. I use a NotifyIcon to activity sub form. In main form's loading event( and doubleclick event of notifyicon ), i wrote something like: notifyIcon.Visible = false;
1
3887
by: Regnab | last post by:
I've got a form where the user can edit the lookups available in the database. It consists of a list box of the various categories on the main form, a checkbox on the main form and a sub form which displays the lookup values in a datasheet format. When a lookup values is no longer current, the user can untick the "Active" box in the datasheet and it will disappear (requeries the subform's recordsource query). On the main form, I have the...
1
2299
by: Claire | last post by:
Hi, I've a problem. Our app has a main screen, a user logs in to the system using a smart card. After login, several loops through a switch statement are performed to check for certain conditions. One or more screens may be shown modally in succession, finally ending in the user's work centre.The user is usually encouraged to pull their card before reaching the work centre as this is primarily a terminal (no keyboard/mouse) for logging in...
0
9595
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
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
10008
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
8891
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...
1
7420
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
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
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
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
3578
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.