Results 1 to 11 of 11

Thread: Message Box that says working please wait.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Posts
    93
    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

  2. #2
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274

    Cool 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]

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357
    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!
    ~seaweed

  4. #4
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606

    barrk

    -->We use an animation control for this<--

    Where is your api, i might need it.

  5. #5
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    Add the component Microsoft Windows Common Controls 2 to your project references. It's in there!

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Posts
    93
    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

  7. #7
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Is it a loop? Then try adding DoEvents.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Posts
    93
    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

  9. #9
    Addicted Member eer3's Avatar
    Join Date
    Sep 2000
    Location
    Ca
    Posts
    165
    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

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Sep 1999
    Posts
    93
    Thanks to everyone for putting up with me.

    You guys are too cool.

    Thanks
    Brandon

  11. #11
    Guest
    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
  •  



Click Here to Expand Forum to Full Width