[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

Force a form to Paint?

Ola,
My forms won't paint entirely during timer function "pauses". My DBDataform might not be able to be populated til the DB becomes available, so I made a little Please_Wait form. I copied a little Timer function pause from a previous question, .show the Please_Wait while I loop til the DB becomes available (or it times out), but the label in the Please_Wait never shows cause the paint never completes.
Here's the code:
If rsTransaction.Fields("IsBusy") = True Then
  PauseTime = 1 ' Set duration.
  Start = Timer ' Set start time.
  PleaseWait.Label1.Caption = "Waiting for Database to become available"
  PleaseWait.Caption = "Database in use Please Wait"
  PleaseWait.Show
  Finish = Timer + 5 ' Set debug end time.
 Do
  Do While Timer < Start + PauseTime
  Loop
  'debug--Pretend DB is busy 5 secs
  If Finish < Timer Then
   rsTransaction.Edit
   rsTransaction.Fields("IsBusy") = False
   rsTransaction.Update
  End If
 Loop Until (rsTransaction.Fields("IsBusy") = False)
 Unload PleaseWait

Is there a "Paint-the-dang-form-before-anything-else" function?
THanks
Bob

0
BobMiner
Asked:
BobMiner
  • 2
  • 2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
Add a DoEvents here:

PleaseWait.Caption = "Database in use Please Wait"
PleaseWait.Show
DoEvents
Finish = Timer + 5 ' Set debug end time.
0
 
mcriderCommented:
Instead of doing a DoEvents, which can allow other events to fire, do this:

With PleaseWait
     .Label1.Caption = "Waiting for Database to become available"
     .Caption="Database in use Please Wait"
     .Show
     .Label1.Refresh
     .Refresh
End With



Cheers!
0
 
BobMinerAuthor Commented:
Thanks McRider
That worked perfectly.
Bob
0
 
BobMinerAuthor Commented:
Thanks McRider
That worked perfectly.
Bob
0
 
mcriderCommented:
Glad I could help! Thanks for the points!


Cheers!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now