Solved

VB.NET (NetFramework 3.5) Can't hide startup form in VB.NET

Posted on 2009-06-27
14
501 Views
Last Modified: 2012-05-07
Hi, Im not able to hide vb.net startup form.

Tried :

me Me.Visible = False
me.hide

Public Class Form3
 

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim start_info As New ProcessStartInfo("upd.exe")

        Dim proc As New Process

        proc.StartInfo = start_info

        proc.Start()

        proc.WaitForExit()

        LoginForm1.Show()

        Me.Visible = False

    End Sub

End Class

Open in new window

0
Comment
Question by:GameOverlayUI
  • 6
  • 4
  • 4
14 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 24729316
Did you try moving the Me.Hide() to the top of the sub, so like this:
Public Class Form3

 

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.Hide()

        Dim start_info As New ProcessStartInfo("upd.exe")

        Dim proc As New Process

        proc.StartInfo = start_info

        proc.Start()

        proc.WaitForExit()

        LoginForm1.Show()

    End Sub

End Class

Open in new window

0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24729319
You can change the Opacity to 0 to hide the form.
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 24729323
Otherwise, you can try changing your application to launch through Sub Main first instead of form, then from your Sub Main (Module) you load up the login form instead of starting with Form3.
0
 

Author Comment

by:GameOverlayUI
ID: 24729366
opacity is not working either..
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24729376
You want to run that code in the start up ? Can you describe more ?
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 24729378
Did my suggestions not work either?
0
 

Author Comment

by:GameOverlayUI
ID: 24729383
I put me.hide on top of the form and also opacity to 0, the form is not visible but still stay in taskbar menu
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:GameOverlayUI
ID: 24729388
mwvisa1: can you type code how to do that.
0
 

Author Comment

by:GameOverlayUI
ID: 24729389
btw, my application starts with loginform
0
 

Author Comment

by:GameOverlayUI
ID: 24729391
i mean should start, but I use form3 to check update before login form is shown
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 24729401
Ok, then go to My Project - Application Tab and select "View Application Events".
Use your code in the Me.Startup that will run before the application loads.

Namespace My
 

    ' The following events are available for MyApplication:

    ' 

    ' Startup: Raised when the application starts, before the startup form is created.

    ' Shutdown: Raised after all application forms are closed.  This event is not raised if the application terminates abnormally.

    ' UnhandledException: Raised if the application encounters an unhandled exception.

    ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. 

    ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.

    Partial Friend Class MyApplication
 

        Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
 

            ' you code here
 

        End Sub

    End Class
 

End Namespace

Open in new window

0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 24729419
JPaulino got it.  It is pretty much same idea.  The initial method I was talking about was creating a Module with Sub Main then in the same place (My Project) you can change the startup to be Sub Main instead of Form3, but this should work for you.
0
 

Author Closing Comment

by:GameOverlayUI
ID: 31597603
thanks.
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24729437
That's right mwvisa1, the only problem creating a Sub Main in a module is that you have to disable the application framework, and all that option you have, to allow select the module.
But it works the same way.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now