• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 532
  • Last Modified:

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

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
GameOverlayUI
Asked:
GameOverlayUI
  • 6
  • 4
  • 4
1 Solution
 
Kevin CrossChief Technology OfficerCommented:
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
 
Jorge PaulinoIT Pro/DeveloperCommented:
You can change the Opacity to 0 to hide the form.
0
 
Kevin CrossChief Technology OfficerCommented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
GameOverlayUIAuthor Commented:
opacity is not working either..
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
You want to run that code in the start up ? Can you describe more ?
0
 
Kevin CrossChief Technology OfficerCommented:
Did my suggestions not work either?
0
 
GameOverlayUIAuthor Commented:
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
 
GameOverlayUIAuthor Commented:
mwvisa1: can you type code how to do that.
0
 
GameOverlayUIAuthor Commented:
btw, my application starts with loginform
0
 
GameOverlayUIAuthor Commented:
i mean should start, but I use form3 to check update before login form is shown
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
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
 
Kevin CrossChief Technology OfficerCommented:
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
 
GameOverlayUIAuthor Commented:
thanks.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 6
  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now