I have a command that takes a long time to retrieve information. How can I make a message box that says working please wait? It seems like my program is doing nothing or is locked up the way I have it now.
Thanks
Brandon
Printable View
I have a command that takes a long time to retrieve information. How can I make a message box that says working please wait? It seems like my program is doing nothing or is locked up the way I have it now.
Thanks
Brandon
We use an animation control for this. (You know the folders with the papers flying from one to another?) It goes right on the form and the user doesn't have to close a msgbox when it is complete. Thats it! Works great. Good Luck and Have Fun.
[Edited by barrk on 10-18-2000 at 12:58 PM]
You can't use a message box because it's a modal form, and all processing will stop until the user responds to it, but you can show another form that has a label on it containing the message you want to show the user. Change the border style of the form to 0-None so the user can't close it. Then do something like this:
Another (better) idea might be to use a form with a progress bar on it to show that something is going on. You need to be able to update the bar between data accesses.Code:Me.Hide
frmPleaseWait.Show
' Do your data access stuff here
unload frmPleaseWait
Me.Show
Hope that helps!
-->We use an animation control for this<--
Where is your api, i might need it.
Add the component Microsoft Windows Common Controls 2 to your project references. It's in there!
Thanks Guys I have added the animation control, but my main problem is not the time it takes to run the command. When I run this command it locks the program up until it completes. I can't minimize the form or reopen it if I finally get it minimized.
Is there some command I should run before I run this command that take so long to process?
I can give you my code if you need it. What I am doing is checking files on a network server.
Thanks
Brandon
Is it a loop? Then try adding DoEvents.
Here is the code. It writes folder sized to a list box. It just takes a long time to process.
Option Explicit
Sub ShowFolderList(folderspec)
Dim FolderScript, MainFolder, SubFolder, User, CurrentDir, Size
Set FolderScript = CreateObject("Scripting.FileSystemObject")
Set MainFolder = FolderScript.GetFolder(folderspec)
Set CurrentDir = MainFolder.SubFolders
For Each SubFolder In CurrentDir
On Error Resume Next
User = SubFolder.Name
Size = SubFolder.Size / 1052613.06
List1.AddItem User
List2.AddItem Format(Size, "#,##0")
User = User & vbCrLf
Next
End Sub
Private Sub Command1_Click()
Call ShowFolderList("\\fpr1-wn-plt\group\wn-plt-all\private\")
End Sub
Quote:
Originally posted by BJ
Here is the code. It writes folder sized to a list box. It just takes a long time to process.
Option Explicit
Sub ShowFolderList(folderspec)
Dim FolderScript, MainFolder, SubFolder, User, CurrentDir, Size
Set FolderScript = CreateObject("Scripting.FileSystemObject")
Set MainFolder = FolderScript.GetFolder(folderspec)
Set CurrentDir = MainFolder.SubFolders
For Each SubFolder In CurrentDir
DoEvents 'Like Jop said, this is all you should need
On Error Resume Next
User = SubFolder.Name
Size = SubFolder.Size / 1052613.06
List1.AddItem User
List2.AddItem Format(Size, "#,##0")
User = User & vbCrLf
Next
End Sub
Private Sub Command1_Click()
Call ShowFolderList("\\fpr1-wn-plt\group\wn-plt-all\private\")
End Sub
Thanks to everyone for putting up with me.
You guys are too cool.
Thanks
Brandon
you can also just use a simple label
When the processing is finished you can make the labelsCode:
label1.caption = "Please wait, processing.....
label1.refresh
'your processing here
visible property to false
Code:'your processing here
label1.visible = false