Results 1 to 5 of 5

Thread: Sub Main () [Resolved]

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127

    Sub Main () [Resolved]

    This is in part two of my other post for an opinion on using a panel for a splash screen. I opted to not use the panel but I tried adding a Form2 to use instead.

    Form1 is my main program, I have added a Form2 and placed this code below in it. I have changed the startup object to Form2 and I can get it to load before Form1 correctly so I can use Form2 as my splash screen.

    Code:
    Public Class Form2
        Inherits System.Windows.Forms.Form
    
    + Windows Form Designer Generated Code
    
    <STAThread()> Shared Sub Main()
    
            
            Dim frm1 As Form1
    
           
            frm1 = New Form1()
    
          
            Application.Run(frm1)
    
        End Sub
    
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
         Me.Close
    
        
        End Sub
    My trouble is that when I push the button on Form2 to close it and show Form1 "My main program" it closes the Form2 but doesn't bring up my Form1 "main program" as it should.

    Any other thoughts on what's wrong? Knowing me it's something simple or just my lack of knowledge.

    P. S. Pirate, I liked your splash screen but for some reason it didn't work when I tried to impliment it with my program.
    Last edited by teamdad; Jun 25th, 2004 at 08:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width