|
-
Feb 12th, 2009, 06:50 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] how to make a "Please Wait While.." form
VB6 app.
Connecting remotely to my database can take sometime... I would like to have a form load that disables the original form show onscreen and reads simply, "Please wait while I process your request."
Then when the connection is made, the info is queried and filled, have the please wait form unload itself.
I tried wrapping my connections with:
Code:
frmWait vdModal, Me
all my code and fillfields stuff here
unload frmwait
but that didn't work. frmWait never unloads... I guess because it is shown modally. However, I thought that was a decent idea. Maybe that idea just needs from tweaking?
-
Feb 12th, 2009, 08:34 PM
#2
Addicted Member
Re: how to make a "Please Wait While.." form
I don't think you want to show your wait form as vbModal. All processing would be stopped on the calling form.
I had a similar need a couple of years ago and I ended up using a Hidden Picture Box that had the topmost ZOrder when displayed. When done processing just hide the Picture Box. You could also include a progress bar if that is appropriate for what your doing.
-
Feb 12th, 2009, 10:51 PM
#3
Thread Starter
Fanatic Member
Re: how to make a "Please Wait While.." form
Oh, I didn't realize modal stopped processing on that form. Thanks.
I will try something like your picturebox idea.
-
Feb 12th, 2009, 11:23 PM
#4
Junior Member
Re: how to make a "Please Wait While.." form
Why not just change to a form with no clipbox, however make sure you put a button on it like disconnect or cancel if your not using a timer to abort the connection process after a given time.
Assuming you are using Winsock, just make a callback function to return the socket.state in actual words and pass it to your label so the user knows whats going on during the establishment of the connection.
-
Feb 12th, 2009, 11:46 PM
#5
Re: how to make a "Please Wait While.." form
Do you want to do something like this?
Code:
Option Explicit
Private Sub Form_Load()
Label1.Caption = ""
Timer1.Enabled = True
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Dim MyWord
Static i As Integer
i = i + 1
MyWord = Array("L", "o", "a", "d", "i", "n", "g", ".", ".", ".", ".", ".")
Label1.Caption = Label1.Caption & MyWord((i) - 1)
If i = 12 Then
i = 0
Label1.Caption = ""
End If
End Sub
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Feb 13th, 2009, 09:24 AM
#6
Re: how to make a "Please Wait While.." form
Just do this:
Code:
frmWait.Show , Me
Me.Enabled = False
all my code and fillfields stuff here
unload frmWait
Me.Enabled = True
-
Feb 13th, 2009, 10:43 AM
#7
Addicted Member
Re: how to make a "Please Wait While.." form
Be careful if you choose to use a non-modal form for the display. It can easily get lost behind other forms which is the very reason I went with the Picture Box. That can happen even if you use the OnTop API.
-
Feb 13th, 2009, 11:35 AM
#8
Thread Starter
Fanatic Member
Re: how to make a "Please Wait While.." form
Thank you for the posts and suggestions.
I was also trying to do CVMichael's idea recently, but it was getting lost behind forms at times.
That was why I tried showing it modally.
-
Feb 13th, 2009, 12:13 PM
#9
Re: how to make a "Please Wait While.." form
When you set the OwnerForm, it's impossible that it goes behind the owner window...
Are you sure you set the OwnerForm ?
frmWait.Show , Me
-
Feb 13th, 2009, 12:27 PM
#10
Re: how to make a "Please Wait While.." form
To extend on that...
You basically have 3 states:
This is non-modal, and it can go behind other forms
frmWait.Show
This is non-modal, but it does NOT go behind it's Owner
frmWait.Show , Me
This is Modal, and and it also stops execution of code in the Owner until it's closed
frmWait.Show vbModal, Me
For example, start a new project, add 2 more forms, try this code
Code:
Private Sub Form_Load()
Form1.Show
Form2.Show , Form1
Form3.Show , Form2
End Sub
And also try this
Code:
Private Sub Form_Load()
Form1.Show
Form2.Show , Form1
Form3.Show , Form1
End Sub
Notice the difference in the Owner in both examples
Last edited by CVMichael; Feb 13th, 2009 at 12:33 PM.
-
Feb 15th, 2009, 11:19 AM
#11
Thread Starter
Fanatic Member
Re: how to make a "Please Wait While.." form
Nope, I didn't set the owner form... I am using it now, seems to work for me.
Also tossing around the picturebox idea... I fill it with a picture that says "Please Wait" while disabling me.form. Then enabling the form after everything is processed.
Thanks for your help.
I also like using CDRIVE's LOADING form. Good stuff.
Last edited by chris.cavage; Feb 15th, 2009 at 11:47 AM.
-
Jul 30th, 2009, 12:42 PM
#12
Thread Starter
Fanatic Member
Re: how to make a "Please Wait While.." form
Ok, this is resolved. Most of the reason why I wanted this to work was because of my remote db connection. I have used adAsynConnect when my connections are open, and I use a "Loading" animation (with help from si the geek) on a separate thread.
I disabled the form while it's connecting, upon connection_complete event, I re-enable the form. The user stays on the form the whole time, and can visually see the "Loading" animation in the top right corner, so he/she knows my application is connecting properly.
Thanks.
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
|