[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Refreshing Screen after Switching Tasks

Hello Experts!

I have a program that I run that copies files from one Server to another using the FileCopy command.  This is not the problem, however depending on the size and number of files I'm copying I don't like to sit there and watch the screen and progress bar for 10 minutes.

So if switch tasks to check e-mail in outlook or start typing a letter in Word and then switch back to my program doing the copy to check on the progess bar, my screen is Blank (white space).  It almost looks like it's hung up and not doing anything, but it really is because it will finally finish.  How can I refresh the screen when I switch back to this task to check on the file copy progress?

Thanks,
smithmrk
0
smithmrk
Asked:
smithmrk
1 Solution
 
Erick37Commented:
Place a DoEvents statement in the loop.  DoEvents will allow other events to fire (like refreshing the screen) while the loop is processing.  Be careful to disable any command buttons or menu items you do not want the user to run while the loop is processing if you use DoEvents.
0
 
cjardCommented:
for example before:

'assume files() is an array with 10000 file names to copy

For i = 1 to UBound(files)
  FileCopy sourcepath & files(i), destpath & files(i)
  ProgressBar.Value = ProgressBar.Value + 1
Next i


for example after:
For i = 1 to UBound(files)
  FileCopy sourcepath & files(i), destpath & files(i)
  ProgressBar.Value = ProgressBar.Value + 1
  DoEvents 'redraw screen, process windowmessages and keypresses etc
Next i
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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