Me.Visible or Me.Hide ???? Help

I want to make my VB application run in "hidden" mode, with no interface or GUI

This is my code so far, but I can still see the Windows form.....

 

Public Class Form1

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

Me.Visible = False

End Sub

End Class

I even tried the Me.Hide() method, but I can still see the GUI when I run the app.  Any help would be greatly appreciated.



Answer this question

Me.Visible or Me.Hide ???? Help

  • SKumar_Rsk

    Pipped to the post.

    I was about to ask why include a GUI in your project if you don't want it to be visible. If you succeeded in hiding it how would you end the program.


  • James Lau

    have you considered a Console task



  • Adrian Militaru

    Okay, If I put Me.Hide() in the Paint function, it works.

    However, you can still see the GUI flash on screen and in the task bar before it disappears. Anyone know how to prevent this


  • RDV0326

    Well, if it works on a butten function, why not try the load function


  • Paul M

    Perhaps I was misunderstood. My program will be running in the system tray when it is finished. But as for now, I just need to know how to make my program NOT load the gui interface as its not needed.

    In the form_Load function I tried Me.Hide(), but it didnt work. However, when I use Me.Hide with a button, it works fine. I want my application to load in a "hidden" state.


  • SachinN

    hi,

    you can take a look to the notifyIcon class

    http://msdn2.microsoft.com/en-us/library/system.windows.forms.notifyicon.aspx

    hope this helps



  • Alberto Ferreira

    thanks shakalama,

    but i still can't seem to figure out how to prevent the form from visibly showing. I am using VB express.


  • GEKLJASEJF

    hi,

    why don't you creat a windows service, i don't know much about it but i guess its your need

    http://msdn2.microsoft.com/en-us/library/y817hyb6.aspx

    hope this helps



  • Guru2228

    I found out that if I put "Me.Hide()" in a button function it works. But I want my application to load with no GUI. :( I'm stumped.
  • Sam Matthews

    Hi, give this a try:

    Go to project properties, disable application framework(under Application), and set the Startup form to Sub Main.

    Add a Module to your project with the following code:

    Sub Main()

    Dim myForm As New Form1
    Application.Run()

    End Sub

    This will have your form running in the background, usually you'll need to provide a way for the user to invoke the form, for example a double click on the notify icon. Also keep in mind that closing the form will not close the application so you'll have to call Application.Exit() explicitly.



  • NesherHH

    This is one difference between VB6 and VB2005: the form will always show and it's very annoying (I have an application that doesn't need to show the interface inmmidiately, and runs in the system tray).

    Cheap hack number 1:

    set the form Opacity to zero - this effectively makes it invisible.

    Cheap Hack number 2:

    position the form off the screen (beware of multimonitors!). This is just too hackish for me .

    Cheap Hack number 3:

    There's a visibilitychanged event. When the form finishes loading, hide the form in the VisibilityChanged event (Combine with Cheap Hack number 1).

    (Don't forget the ShowInTaskBar property, also).

    You can also disable the 'use application framework', as Ryan stated. Ofcourse, the disadvantage of this is that you loose the application events (one of the more attractive features of the using the application framework).

    The above are pretty cheap hacks (but then that's what I've been used to with VB6), but work ok. There may be a way to override some of the form subs, but I got bored trying it after an hour or so.



  • Me.Visible or Me.Hide ???? Help