Hi - am using the inbuilt Splash Screen feature of vb.net 2005. I wanted to have a label on the screen which I can update as various events occur during startup - e.g. "Connecting to Mainframe...", "Connecting to Oracle DB..." etc. However, no matter how I try, I keep falling foul of the error :-
"Cross-thread operation not valid: Control 'lblStatus' accessed from a thread other than the thread it was created on."
What I had set up was a Public Sub on the Splash form that allowed the text to be displayed to be passed as a parameter - the label on the screen is amended and refreshed.
The calls are all placed in the MyApplication_Startup sub. The first call works fine, the next one fails with the message above.
One solution is to manually manage this form through code (the way I would have done in VB6), but I'd like to think that this new splash feature would be a cleaner way to develop!
Does anyone know what I am doing wrong, or indeed, is there a way around this?
Start Free Trial