469,584 Members | 2,227 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,584 developers. It's quick & easy.

Hide Form on Load

I'm making a system tray application, and I just can't figure out how
to make it hide on execution just like it used to in C++.

If I have a button the form and in the button's Click method i have
{this.Hide();}
The entire form will disappear.

But if I put "this.Hide()" in the from's onLoad code, it *doesn't* get
hidden.
Can anyone advise me as to what I'm doing wrong? Why would the same
code that hides the form just fine as an onClick method *not* work for
onLoad?

By Hide I mean for it to disappear from the taskbar, alt-tab, and main
window, but remain in the system tray.

Does .NET not allow hiding of forms upon load for security reasons or
something? Because that sounds pretty naive to me...
I'm sure there's a way though...

Thanks!

Mar 28 '07 #1
2 9395
On Mar 28, 9:14 am, mqu...@gmail.com wrote:
I'm making a system tray application, and I just can't figure out how
to make it hide on execution just like it used to in C++.

If I have a button the form and in the button's Click method i have
{this.Hide();}
The entire form will disappear.

But if I put "this.Hide()" in the from's onLoad code, it *doesn't* get
hidden.
Can anyone advise me as to what I'm doing wrong? Why would the same
code that hides the form just fine as an onClick method *not* work for
onLoad?

By Hide I mean for it to disappear from the taskbar, alt-tab, and main
window, but remain in the system tray.

Does .NET not allow hiding of forms upon load for security reasons or
something? Because that sounds pretty naive to me...
I'm sure there's a way though...

Thanks!
You may want to check out this article:
http://www.windowsforms.net/articles...lications.aspx

Basically, you don't want to have a form show at all; just start your
custom ApplicationContext to put the icon in the tray.

Mar 28 '07 #2
On Mar 28, 3:24 pm, "Andy" <a...@med-associates.comwrote:
On Mar 28, 9:14 am, mqu...@gmail.com wrote:
I'm making a system tray application, and I just can't figure out how
to make it hide on execution just like it used to in C++.
If I have a button the form and in the button's Click method i have
{this.Hide();}
The entire form will disappear.
But if I put "this.Hide()" in the from's onLoad code, it *doesn't* get
hidden.
Can anyone advise me as to what I'm doing wrong? Why would the same
code that hides the form just fine as an onClick method *not* work for
onLoad?
By Hide I mean for it to disappear from the taskbar, alt-tab, and main
window, but remain in the system tray.
Does .NET not allow hiding of forms upon load for security reasons or
something? Because that sounds pretty naive to me...
I'm sure there's a way though...
Thanks!

You may want to check out this article:http://www.windowsforms.net/articles...lications.aspx

Basically, you don't want to have a form show at all; just start your
custom ApplicationContext to put the icon in the tray.
Thanks a bunch!

I was following the MSDN docs, and I put this in the Main()
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Form F1 = new BackupWindow();
//So it doesn't exit..
Application.Run();

But when I when F1 exits, Application doesn't...
This custom context takes care of it!

Mar 28 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Don Grover | last post: by
9 posts views Thread by Mark | last post: by
5 posts views Thread by Kirk Graves | last post: by
4 posts views Thread by Matthew | last post: by
4 posts views Thread by BrianDH | last post: by
4 posts views Thread by DBC User | last post: by
3 posts views Thread by Raj Wall | last post: by
13 posts views Thread by jeff | last post: by
6 posts views Thread by Doogie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.