Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2780
  • Last Modified:

How do I hide the splash screen on application load? VB.NET 2005

OK, here is the problem....

When I load my application I am using the application loading events in VS.NET 2005...  The problem is that the module events will sometimes cause msgbox errors, etc..  The issue is that the splash screen will cover them up.

I have tried:
 Splash screen is NOT set to top (does not work)
 Sending the splashscreen to the back on load (does not work)
 hide the form from the application startup (errors b/c that form is in another thread)
 
Example of startup events which references the module

        Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
            ' put your formless code in here...
            ' you could even call Subs/Functions that reside in a Module from
            ' here if you like...

            ' prevent the "Startup Object" from showing...
            e.Cancel = True

            'Start system pre-start sequence
            StartSystemLoad()

            ' allow the "Startup Object" to show...
            e.Cancel = False
        End Sub

So how would I access the thread the splash screen is on?  Maybe you can think of an easier solution?  My splash screen is referenced as: Splash_Screen_Form = Me

and the code that throws the thread error is simply Splash_Screen_Form.Hide()

Thanks for all your help!
John
0
jdraggi
Asked:
jdraggi
  • 4
  • 4
1 Solution
 
PockyMasterCommented:
create startup module.

spawn your splash screen from that.

create a workerthread to initialize all your things you need to do, while showing some progressbar on your splash e.g.
when done, just load your main form and kill the splash screen

0
 
jdraggiAuthor Commented:
Well.. 2005 doesn't allow a module to be used as a startup form but I suppose I could tell the app to not use a splash screen... call the module from the application startup events like I am doing now...  and just toss in the splash screen in the startup events...  hiding it whenever I catch an error...

0
 
PockyMasterCommented:
it doesn't?
of course it does.
uncheck 'application framework' in your project properties
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
jdraggiAuthor Commented:
nope, if I uncheck my modules still do not show up...  This is one of the items that I had to convert when I came over from 2003 because I did have a module starting up prior that controlled all of that.

I changed to code to:

    Partial Friend Class MyApplication
        Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
            ' put your formless code in here...
            ' you could even call Subs/Functions that reside in a Module from
            ' here if you like...

            ' prevent the "Startup Object" from showing...
            e.Cancel = True

            If Splash_Screen_Form Is Nothing Then
                Splash_Screen_Form = New SplashScreen
                Splash_Screen_Form.Show()
            End If

            'Start system pre-start sequence
            StartSystemLoad()

            'Wait 3 seconds
            System.Threading.Thread.Sleep(3000)

            ' allow the "Startup Object" to show...
            e.Cancel = False
            Splash_Screen_Form.Dispose()
        End Sub
    End Class

Have to check
0
 
jdraggiAuthor Commented:
That took care of it... the msgbox is now a child of the splash screen.

Thanks!  I guess I was just thinking too complex.

--John
0
 
PockyMasterCommented:
Well, if you want your startup things to show messages, pass them a delegate to a display function on your splash screen.
Instead of them raising messageboxes, they will call upon your splash screen.
0
 
jdraggiAuthor Commented:
I don't know how to do that do you have a simple code example?

--John
0
 
PockyMasterCommented:
Create a delegate in a logClass
e.g. public delegate sub DoSomeLogging(myLogString as string)
create a member variable in your initialisation classes of that type
private _myLogger as logClass.DoSomeLogging

in the copy constructor of your init class pass the delegate
public sub new (myLogger as logClass)
_myLogger = myLogger
end sub

Later you can use it by calling
_myLogger("my first logtext")

Implement a log function with the same footprint in your splash form
Private sub MyLocalLogger(myLogString as string)
'perform your logging here
end sub

and when calling your init functions pass the address of your logger to them

dim myInitClass as new InitClass(addressof MyLocalLogger)

Get it?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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