Showing a form whilst code is running...

B

Bob Quintal

=?Utf-8?B?RGFuaWVsV2FsdGVyczY=?=
Hi I have a simple splash screen that I would like to display
at the start of my project.

Attached to the form_open routine is the following code

Code:
Option Compare Database
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds
As Long)
'http://www.rohitab.com/discuss/lofiversion/index.php/t6093.ht m
l

Private Sub Form_Open(Cancel As Integer)
Form.Visible = True
TxtTime.Caption = 5
Sleep 1000
TxtTime.Caption = 4
Sleep 1000
TxtTime.Caption = 3
Sleep 1000
TxtTime.Caption = 2
Sleep 1000
TxtTime.Caption = 1
End Sub

What this does is count down five seconds. Each second it
should update the value of a label within the form, to show
the user how many seconds that they have left until the
project opens.

However, the form wait for the 5 seconds, is then displayed
with "1" as the label caption.

So it's processing the code OK, but not displaying the form
whilst it's happening!
I've tried to make the form visible from the start by
form.visible=true, but this has had no effect whatsoever...

Is there a way to turn ECHO on or something along those lines?

TIA for any help

Dan Walters
Insert a DoEvents statement between each change of caption and
the sleep statement. That is supposed to let the system update
the screen.

txtTime.Caption = 5
DoEvents
Sleep 1000
 
D

DanielWalters6

Hi I have a simple splash screen that I would like to display at the start of
my project.

Attached to the form_open routine is the following code

Code:
Option Compare Database
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'http://www.rohitab.com/discuss/lofiversion/index.php/t6093.html

Private Sub Form_Open(Cancel As Integer)
Form.Visible = True
TxtTime.Caption = 5
Sleep 1000
TxtTime.Caption = 4
Sleep 1000
TxtTime.Caption = 3
Sleep 1000
TxtTime.Caption = 2
Sleep 1000
TxtTime.Caption = 1
End Sub

What this does is count down five seconds. Each second it should update the
value of a label within the form, to show the user how many seconds that they
have left until the project opens.

However, the form wait for the 5 seconds, is then displayed with "1" as the
label caption.

So it's processing the code OK, but not displaying the form whilst it's
happening!
I've tried to make the form visible from the start by form.visible=true, but
this has had no effect whatsoever...

Is there a way to turn ECHO on or something along those lines?

TIA for any help

Dan Walters
 

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