Results 1 to 4 of 4

Thread: Forms control via Startup Class.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2003
    Location
    When?!?!
    Posts
    108

    Forms control via Startup Class.

    Ok, I have a splash and a class. as default, it displays the splash before doing anything else. then after it has completed its tasks in Sub Main, I want it to close the splash and open the main form. But the splash form doesn't close!!! what do I do??
    DannyJoumaa
    Advanced VB6 Programmer
    Intermediate-Advanced VB .NET Programmer
    Intermediate C# Programmer
    Intermediate Win32 Developer
    Beginner Mac OS X Developer
    Contact: [email protected]

    Favorite Sayings:
    "Every time you open your mouth, you prove your an idiot."
    "God is a programmer. Satan is a bug. Life is debugging."

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Start by posting your Main sub so we can not 'shoot from the hip' to solve your problem.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2003
    Location
    When?!?!
    Posts
    108
    VB Code:
    1. Shared Sub main()
    2.         Try
    3.             Application.EnableVisualStyles()
    4.             Dim msg As New frmMSG
    5.             Dim splash As New frmSplash
    6.             Dim s As New StartUp
    7.             Application.Run(splash)
    8.            
    9.         ' Do some loading code
    10.  
    11.             splash.Close()
    12.             Dim main As New frmMain
    13.             Application.Run(main)
    14.         Catch
    15.             MsgBox("An error has occured. Program may continue to run, but saftey measures presist to close this application." & vbLf & vbLf & "Click OK to terminate the application.", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Error " & CType(Err.Number, String))
    16.             Debug.Write("Error " & CType(Err.Number, String) & " occured." & vbLf & "Error Information: " & Err.Description & " " & Err.Source)
    17.             End
    18.         End Try
    19.     End Sub
    DannyJoumaa
    Advanced VB6 Programmer
    Intermediate-Advanced VB .NET Programmer
    Intermediate C# Programmer
    Intermediate Win32 Developer
    Beginner Mac OS X Developer
    Contact: [email protected]

    Favorite Sayings:
    "Every time you open your mouth, you prove your an idiot."
    "God is a programmer. Satan is a bug. Life is debugging."

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Code:
        
    Shared Sub main()
            Try
                Application.EnableVisualStyles()
                Dim msg As New frmMSG
                Dim splash As New frmSplash
                Dim s As New StartUp
    
                splash.Show()
                
    	    ' Do some loading code
    
                splash.Close()
                Dim main As New frmMain
                Application.Run(main)
                'or
                'main.ShowDialog()
            Catch
                MsgBox("An error has occured. Program may continue to run, but saftey measures presist to close this application." & vbLf & vbLf & "Click OK to terminate the application.", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Error " & CType(Err.Number, String))
                Debug.Write("Error " & CType(Err.Number, String) & " occured." & vbLf & "Error Information: " & Err.Description & " " & Err.Source)
                End
            End Try
        End Sub

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