By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,953 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,953 IT Pros & Developers. It's quick & easy.

Focus after Splash Screen

P: 7
When my splash screen auto closes, the program's main form has its title bar dark grey instead of the usual dark blue, and I have to click somewhere on the main form to give it focus.

This problem doesn't show up when I run the program from within VB Express, but only after I've published to my own computer (to get easier access to the .exe file).

If I do away with the splash screen, then the published program starts with its main form having focus, as one would expect.

Any ideas how I fix this, please?

Regards
Allan Stead
Sep 2 '07 #1
Share this Question
Share on Google+
8 Replies


Robbie
100+
P: 180
In VB6 there's a function ZOrder(), which is used like this:
Expand|Select|Wrap|Line Numbers
  1. SomeForm.ZOrder(vbBringToFront)
That function would probably do what you want to be done.

I don't know if this exists in the version of VB you're using.
But you could try searching through its functions or documentation for a way to bring it back to the top (since it might be named similarly to this...?)
Sep 3 '07 #2

P: 7
Hi Robbie

Thanks for the suggestion. In VB Express the command appears to be Me.BringToFront() and I entered it at the end of the FormActivated event of my main program form, but it didn't solve the problem.

Thanks for trying, anyway

Allan
Sep 5 '07 #3

Expert 5K+
P: 8,434
... Me.BringToFront() ... end of the FormActivated event ... didn't solve the problem.
Try doing it immediately after the command which hides (or unloads) the splash form.

Also, though I don't know what your equivalent would be, in VB6 SomeForm.Show would work just as well, and would confuse less people. :) Admittedly though, the BringToFront() method sounds rather more obvious than ZOrder.
Sep 5 '07 #4

P: 7
Try doing it immediately after the command which hides (or unloads) the splash form.

Also, though I don't know what your equivalent would be, in VB6 SomeForm.Show would work just as well, and would confuse less people. :) Admittedly though, the BringToFront() method sounds rather more obvious than ZOrder.
I'm not sure if I'll be able to take up this suggestion, as VB Express shows and hides the splash screen all by itself as an option from within the Application tab of My Project. Any idea how I can get at the hide or unload command?
Sep 7 '07 #5

Robbie
100+
P: 180
Any idea how I can get at the hide or unload command?
No, but if VB Express is failing to give focus back, then it isn't working as it should.

Why don't you make your own one?
It's really very simple... if it's only meant to be an image:
Make a new form called SplashForm or something like that,
Add a PictureBox which shows the splash image,
Set the form properties so that no border is shown,
Add a timer which, after a certain amount of time, hides this form, and shows the main program form and tries to bring focus to it (using example code which Killer / I have suggested).

I would at least try that before giving up. ^-'
Sep 7 '07 #6

waynespangler
P: 8
Here is some code to try:

Expand|Select|Wrap|Line Numbers
  1.     Dim Done As Boolean = False
  2.     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  3.         Me.Visible = False
  4.         SplashScreen1.Show(Me)
  5.         Do While Not Done
  6.             My.Application.DoEvents()
  7.         Loop
  8.         SplashScreen1.Close()
  9.         Me.Visible = True
  10.     End Sub
  11.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  12.         Done = True
  13.     End Sub
  14.  
  15.  
Sep 7 '07 #7

Expert 5K+
P: 8,434
I'm not sure if I'll be able to take up this suggestion, as VB Express shows and hides the splash screen all by itself as an option from within the Application tab of My Project. Any idea how I can get at the hide or unload command?
I'm not familiar with this version. But I have heard mention of an option which hides "cookie-cutter" code, showing only your own. Perhaps you just need to turn off that option to see the code supplied by VB Express.
Sep 7 '07 #8

P: 1
That worked great—very nice! I was pulling out what is left of my hair trying to get the focus back to the application after the splash screen went away. Using the Project Designer to specify a Splash Screen form does not cut it. Thanks loads.
Sep 26 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.