Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to hide the startup form

How to hide the startup form

Scheduled Pinned Locked Moved Visual Basic
helptutorial
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amer Rehman 0
    wrote on last edited by
    #1

    Can anybody tell me how to make the startup form invisible. The following code snippet in the included MSDN help displays the form for a while and then the form is closed automatically. ' Visual Basic Sub Main() ' Instantiate a new instance of Form1. Dim f1 as New Form1() ' Display a messagebox. This shows the application is running, ' yet there is nothing shown to the user. This is the point at ' which you customize your form. System.Windows.Forms.MessageBox.Show( _ "The application is running now, but no forms have been shown.") ' Customize the form. f1.Text = "Running Form" ' Show the instance of the form modally. f1.ShowDialog() End Sub

    reman

    T L N J 4 Replies Last reply
    0
    • A Amer Rehman 0

      Can anybody tell me how to make the startup form invisible. The following code snippet in the included MSDN help displays the form for a while and then the form is closed automatically. ' Visual Basic Sub Main() ' Instantiate a new instance of Form1. Dim f1 as New Form1() ' Display a messagebox. This shows the application is running, ' yet there is nothing shown to the user. This is the point at ' which you customize your form. System.Windows.Forms.MessageBox.Show( _ "The application is running now, but no forms have been shown.") ' Customize the form. f1.Text = "Running Form" ' Show the instance of the form modally. f1.ShowDialog() End Sub

      reman

      T Offline
      T Offline
      Tom Deketelaere
      wrote on last edited by
      #2

      f1.hide = hides the form (however when the form does an new action after the hide it will apear again) so you might want to use f1.visible = false you can put this code in the load but if you want to make sure you're form is never displayed it might be beter to do it in the activated event hope this helps

      1 Reply Last reply
      0
      • A Amer Rehman 0

        Can anybody tell me how to make the startup form invisible. The following code snippet in the included MSDN help displays the form for a while and then the form is closed automatically. ' Visual Basic Sub Main() ' Instantiate a new instance of Form1. Dim f1 as New Form1() ' Display a messagebox. This shows the application is running, ' yet there is nothing shown to the user. This is the point at ' which you customize your form. System.Windows.Forms.MessageBox.Show( _ "The application is running now, but no forms have been shown.") ' Customize the form. f1.Text = "Running Form" ' Show the instance of the form modally. f1.ShowDialog() End Sub

        reman

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Hi, this is how I do it (example is C#):

        [STAThread]
        static void Main() {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Form1 form1=new Form1();
        // to remain hidden, we don't pass the form to App.Run();
        // as a consequence the form must perform an Application.Exit
        // when it quits, closes or receives a SessionEnding event.
        Application.Run();
        }

        So don't hand over your main form to Run() since that would show it, no matter what you do to the form's properties. And be careful to deal with all normal exits PLUS the sessionending stuff (which normally Run would handle). :)

        Luc Pattyn


        try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


        1 Reply Last reply
        0
        • A Amer Rehman 0

          Can anybody tell me how to make the startup form invisible. The following code snippet in the included MSDN help displays the form for a while and then the form is closed automatically. ' Visual Basic Sub Main() ' Instantiate a new instance of Form1. Dim f1 as New Form1() ' Display a messagebox. This shows the application is running, ' yet there is nothing shown to the user. This is the point at ' which you customize your form. System.Windows.Forms.MessageBox.Show( _ "The application is running now, but no forms have been shown.") ' Customize the form. f1.Text = "Running Form" ' Show the instance of the form modally. f1.ShowDialog() End Sub

          reman

          N Offline
          N Offline
          Naji El Kotob
          wrote on last edited by
          #4

          Hi, It seems that your are trying to build a SplashScreen, if this is what you want: Go to Project > Add New Item > Splash Screen ... add your touches + Coding ;) Go to Project > ProjectName Property > Application tab > Splash Screen Drop Down List and select the added form (this will be launched first) hope this helps :)

          NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice...

          1 Reply Last reply
          0
          • A Amer Rehman 0

            Can anybody tell me how to make the startup form invisible. The following code snippet in the included MSDN help displays the form for a while and then the form is closed automatically. ' Visual Basic Sub Main() ' Instantiate a new instance of Form1. Dim f1 as New Form1() ' Display a messagebox. This shows the application is running, ' yet there is nothing shown to the user. This is the point at ' which you customize your form. System.Windows.Forms.MessageBox.Show( _ "The application is running now, but no forms have been shown.") ' Customize the form. f1.Text = "Running Form" ' Show the instance of the form modally. f1.ShowDialog() End Sub

            reman

            J Offline
            J Offline
            Joseph Guadagno
            wrote on last edited by
            #5

            There is a good article here on CodeProject at http://www.codeproject.com/csharp/prettygoodsplashscreen.asp on creating a splash screen. I have used it in past applications.

            Here are some of my articles. Hope this helps! Joseph Guadagno http://www.josephguadagno.net

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups