Home All Groups Group Topic Archive Search About

VB.net 2005 splash screen

Author
15 Jun 2006 8:06 AM
steve
Hi All

I have set a splash screen form as the application splash screen in VB.net
2005

I t runs fine but stays on top when my login screen appears

How can I shut the splash screen down when the login screen is shown

Attempts to close it from the application main form results in error message

e.g frmsplash.close

'Cross thread operation not valid'

Any ideas

Regards
Steve

Author
15 Jun 2006 10:02 AM
Walter Wang [MSFT]
Hi Steve,

Thank you for your post.

Based on my understanding, you're using a background thread to show the
splash form, and tring to close it when the login form shows. If I've
misunderstood anything, please feel free to post here.

Windows Forms uses the single-threaded apartment (STA) model because
Windows Forms is based on native Win32 windows that are inherently
apartment-threaded. The STA model implies that a window can be created on
any thread, but it cannot switch threads once created, and all function
calls to it must occur on its creation thread.

The STA model requires that any methods on a control that need to be called
from outside the control's creation thread must be marshaled to (executed
on) the control's creation thread. The base class Control provides several
methods (Invoke, BeginInvoke, and EndInvoke) for this purpose. Invoke makes
synchronous method calls; BeginInvoke makes asynchronous method calls.

So for your question, the splash form can be closed using following code:

frmsplash.Invoke(new MethodInvoker(AddressOf frmsplash.Close))

Also, Visual Basic 2005 has builtin support for splash form. Please refer
to following msdn documentation:

#My.Application.SplashScreen
http://msdn2.microsoft.com/en-us/1t310742.aspx

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Author
15 Jun 2006 9:22 PM
steve
Hi Walter

I don't know how much they pay you but it isn't enough

Thanks heaps

Regards
Steve

Show quoteHide quote
"Walter Wang [MSFT]" <waw***@online.microsoft.com> wrote in message
news:KbnoZLGkGHA.4528@TK2MSFTNGXA01.phx.gbl...
>
> Hi Steve,
>
> Thank you for your post.
>
> Based on my understanding, you're using a background thread to show the
> splash form, and tring to close it when the login form shows. If I've
> misunderstood anything, please feel free to post here.
>
> Windows Forms uses the single-threaded apartment (STA) model because
> Windows Forms is based on native Win32 windows that are inherently
> apartment-threaded. The STA model implies that a window can be created on
> any thread, but it cannot switch threads once created, and all function
> calls to it must occur on its creation thread.
>
> The STA model requires that any methods on a control that need to be
> called
> from outside the control's creation thread must be marshaled to (executed
> on) the control's creation thread. The base class Control provides several
> methods (Invoke, BeginInvoke, and EndInvoke) for this purpose. Invoke
> makes
> synchronous method calls; BeginInvoke makes asynchronous method calls.
>
> So for your question, the splash form can be closed using following code:
>
> frmsplash.Invoke(new MethodInvoker(AddressOf frmsplash.Close))
>
> Also, Visual Basic 2005 has builtin support for splash form. Please refer
> to following msdn documentation:
>
> #My.Application.SplashScreen
> http://msdn2.microsoft.com/en-us/1t310742.aspx
>
> Hope this helps. Please feel free to post here if anything is unclear.
>
> Regards,
> Walter Wang
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
Author
16 Jun 2006 12:58 AM
Walter Wang [MSFT]
Hi Steve,

Thank you. It is always our pleasure to be of assistance.

Have a nice day!

Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.