Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

How to have an invisible start up form ?

Hi  ✌
I would like a start up form to be invisible, but still have a notification icon in the tray visible for this form ?
Adding me.hide into the form_load doesn't work.  🙃
Any Ideas ? Thank you !
This can be done by changing the transparency and the borderstyle.

This should do the job:
Me.TransparencyKey = Me.BackColor
Me.FormBorderStyle = FormBorderStyle.None
Don't forget that you can also hide your form when alt-tabing by setting ShowInTaskBar to False.
Code
'1
TransparencyKey = BackColor
FormBorderStyle = FormBorderStyle.None

'2
Visible = False

'3
Hide()

'Additional
ShowInTaskBar = False
You can simply remove the form if you don't want it and run the application as a background process.
(Apr 16, 2018 04:54 AM)knetterbot Wrote:  This can be done by changing the transparency and the borderstyle.

This should do the job:
Me.TransparencyKey = Me.BackColor
Me.FormBorderStyle = FormBorderStyle.None

I would use a simple class declaration and compile it with a compiler as a WinForm App. The .exe will have less weight and not action after to hide it.

Search for CodeDOM Compiler.
In C# you can create a Console Application and later set it to a Windows Forms application in the project settings.
In VB.net it is a bit trickier since there is no default Program class file. Here is a quote from StackOverflow:
Quote:By default, VB.NET applications use the mysterious Windows Application Framework which means that the build process adds an entry point for you which automatically runs whichever form you use as the main form. You can access these settings via Project Properties > Application > Windows application framework properties.

If you don't want to use the framework, un-check the Enable application framework check box and then select that you want to use Sub Main as your Startup object. Then you can create a module with a Public Sub Main method which will be the entry point to the application, just like in Program.cs in C#.

EDIT: This will not spawn a form at all. You can later spawn a form when/if needed.
first, you can set opacity = 0
second . set your viewontaskbar or something (i don't remember cuz i don't work on vb anymore) to FALSE

or just add this code like into the form loads
Code
me.[yourformname].opacity = 0
NotifyIcon1.Icon = SystemIcons.Application
NotifiIcon1.BalloonTipIcon = ToolTipIcon.Info
ShowInTaskbar = false

so its will be like this
Code
private stub form1.load(sender as object, byval e as eventargs) handle myform.load
me.[yourformname].opacity = 0
NotifyIcon1.Icon = SystemIcons.Application
NotifiIcon1.BalloonTipIcon = ToolTipIcon.Info
ShowInTaskbar = false
end sub

in case you have another question, send me an PM and i may help you.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by Formula 1Mar 8, 2019 04:45 PM 3 209 Mar 8, 2019 04:45 PM
Last Post: Suspect.
[C#] by ๖ۣۜErexoMar 2, 2017 02:33 AM 15 554 Mar 2, 2017 02:33 AM
Last Post: w4zt3d
[C#] by Ðr1psNov 9, 2015 03:56 PM 19 418 Nov 9, 2015 03:56 PM
Last Post: Ðr1ps