Hi there peeps, shaggy, and other members
Question:
How can I use threading in my applications that show the splash screen while initializing the form to be show then close the Splash Screen when its done to show the selected form
I set the start up to Sub Main. When I run my piece of code below, it
got an error when i showdialogue the selected form
Error:
Not Supported Exception
Control.Invoke ..... etcc
Here's my Long Code
Another Question where should i place threading abort in my appz..Code:Module Main Public nextform As TemplateForm 'Inhereted Form Public curForm As TemplateForm 'Inhereted Form Dim splashScreen As New Wallpaper ' This is the Splash Screen Form Dim t As Thread Public Delegate Sub CloseSplashScreenCallback() Public Delegate Function DeviceRegsCallback() as _ DeviceRegistrationForm Public Delegate Function LoginCallback() As LoginForm Sub Main() ' Upon(startup) t = New Thread(New ThreadStart(AddressOf BackgroundProcess)) t.Start() Application.Run(Splashscreen) curform.ShowDialog End Sub Private Sub BackgroundProcess() ' Select what Form to be load Using ta As New So_UsersDatasetTableAdapters.SO_UsersTableAdapter If ta.CheckifExistingUser.Value = 0 Then Dim refa As IAsyncResult = DeviceRegistrationForm.BeginInvoke(New _ DeviceRegsCallback(AddressOf CallDevRegs)) curForm = DeviceRegistrationForm.EndInvoke(refb) Else Dim refb As IAsyncResult = LoginForm.BeginInvoke(New _ LoginCallback(AddressOf CallLogIn)) curForm = LoginForm.EndInvoke(refb) End If End Using Dim instance As CloseSplashScreenCallback = New _ CloseSplashScreenCallback (AddressOf CLoseSplashScreen) splashScreen.Invoke(instance) End Sub Private Function CallLogIn() As LoginForm Dim frm As New LoginForm Return frm End Function Private Function CallDevRegs() As DeviceRegistrationForm Dim frm As New DeviceRegistrationForm Return frm End Function Private Sub CLoseSplashScreen() splashScreen.Close() End Sub End Module
Hope you can help me with this. Its my problem since last Wed and until now, I can't get the solution




Reply With Quote