VB.net 2005 splash screen

S

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
 
W

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.
 
S

steve

Hi Walter

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

Thanks heaps

Regards
Steve
 
W

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top