|
-
Aug 6th, 2007, 02:15 AM
#1
Thread Starter
Junior Member
Not Supported Exception in Threading
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
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
Another Question where should i place threading abort in my appz..
Hope you can help me with this. Its my problem since last Wed and until now, I can't get the solution
-
Aug 7th, 2007, 01:06 AM
#2
Frenzied Member
Re: Not Supported Exception in Threading
Hi,
I think some of the functions you are using are from the full framework, hence the 'not supported' exception.
Try http://www.codeproject.com/netcf/casoast.asp or http://www.microsoft.com/downloads/d...displaylang=en or http://blogs.msdn.com/davidklinems/a...17/452804.aspx
for samples of splash screens, both multi-threaded and normal.
You can always use a translation site to move from C# to VB
Pete
-
Aug 7th, 2007, 01:16 AM
#3
Thread Starter
Junior Member
Re: Not Supported Exception in Threading
Peeps, thanks a lot for the references you've provided. Most of the C# to VB.Net Converter I had found on the net doesn't fully convert the code, so what I'm doing is I convert it by myself.
You know what after this project, I am planning to migrate form VB.Net to C#.Net which is good for me to start coz I have an adequate background in C/C++ and a little in java..
P.S. If you have a good references on how to Start in C# in a simple way, Kindly give it to me.
Thanks again peeps. May God be with you always
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|