Starting up as a hidden form

  • Thread starter Thread starter agro_r
  • Start date Start date
A

agro_r

When we use


Application.Run(new MyForm());


Our form is automatcally made visible. How can I make it start
invisibly (I want it to start just as a tray icon)?

I tried hiding in in the constructor. no use since the form is show
again by the Application.Run method.

I tried hiding it in the overriden OnLoad property. No effect.

I tried hiding it in the overriden OnActivated property. It succeeds,
but only after the form has flashed to the user for a fraction of a
second. That really isn't beautiful.

So, is there a nice way to do this?

Thanks a lot.
 
If you're trying to do something before the form loads, why not just call
Application.Run later? Or simply not use a form at all? You can do that, you
know?

You can use the Activate event, but you'll probably get some flashing:

Private Sub Form1_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated
Me.Visible = False
End Sub
 
In this design time itself, make the visible property false, and whenever you want to display it make it true

HT
Sudhakar Sadasivun
Microsoft .NET MVP, MCSD.ne
http://weblogs.asp.net/ssadasivun
http://www.mugh.ne


----- agro_r wrote: ----

When we us


Application.Run(new MyForm())


Our form is automatcally made visible. How can I make it star
invisibly (I want it to start just as a tray icon)

I tried hiding in in the constructor. no use since the form is sho
again by the Application.Run method

I tried hiding it in the overriden OnLoad property. No effect

I tried hiding it in the overriden OnActivated property. It succeeds
but only after the form has flashed to the user for a fraction of
second. That really isn't beautiful

So, is there a nice way to do this

Thanks a lot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top