|
-
Oct 18th, 2000, 11:52 AM
#1
Thread Starter
Lively Member
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
-
Oct 18th, 2000, 11:56 AM
#2
Hyperactive Member
Animation
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]
-
Oct 18th, 2000, 11:58 AM
#3
Frenzied Member
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:
Code:
Me.Hide
frmPleaseWait.Show
' Do your data access stuff here
unload frmPleaseWait
Me.Show
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.
Hope that helps!
-
Oct 18th, 2000, 12:01 PM
#4
Frenzied Member
barrk
-->We use an animation control for this<--
Where is your api, i might need it.
-
Oct 18th, 2000, 12:04 PM
#5
Hyperactive Member
Add the component Microsoft Windows Common Controls 2 to your project references. It's in there!
-
Oct 18th, 2000, 12:28 PM
#6
Thread Starter
Lively Member
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
-
Oct 18th, 2000, 12:32 PM
#7
Frenzied Member
Is it a loop? Then try adding DoEvents.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 18th, 2000, 12:39 PM
#8
Thread Starter
Lively Member
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
-
Oct 18th, 2000, 12:46 PM
#9
Addicted Member
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
-
Oct 18th, 2000, 01:36 PM
#10
Thread Starter
Lively Member
Thanks to everyone for putting up with me.
You guys are too cool.
Thanks
Brandon
-
Oct 18th, 2000, 05:58 PM
#11
you can also just use a simple label
Code:
label1.caption = "Please wait, processing.....
label1.refresh
'your processing here
When the processing is finished you can make the labels
visible property to false
Code:
'your processing here
label1.visible = false
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|