|
-
Dec 13th, 1999, 02:46 AM
#1
Thread Starter
Junior Member
Is it possible to disable the "X" on the form whenever processing is being done by the form and then re-enable it when the processing is complete. *We process data against DB2, and it takes couple of seconds (sometimes 10-15) before the operation is complete. And we don't want the user to fool around and click on "X" when the data update is taking place"
TIA.
-
Dec 13th, 1999, 03:32 AM
#2
Lively Member
take a look at my response here:
http://www.vb-world.net/ubb/Forum1/HTML/011482.html
it answers your question perfectly.
--michael
-
Dec 13th, 1999, 04:37 AM
#3
Thread Starter
Junior Member
michael,
thanks for the code. that piece of code works fine for removing "X". But the re-enabling of "X" does not work properly even though I am calling it with MF_INSERT option.
-
Dec 13th, 1999, 06:08 AM
#4
Try this instead. This would be in your form's QueryUnload Event.
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormControlMenu Then
' g_bProcessFinished is a (perhaps) global variable
' that you would set to true when your long-running
' process is complete.
If Not g_bProcessFinished Then
Beep
MsgBox "Please wait. Process is not finished"
Cancel = True
End If
End If
End Sub
------------------
Marty
-
Dec 13th, 1999, 07:20 AM
#5
Just a thought "outside-of-the-box".
In SQL, would transactions help you?
(Begin Transaction, Rollback Transaction, and Commit Transaction)
You may not have to worry so much about the X in the window.
-
Dec 13th, 1999, 07:27 AM
#6
Thread Starter
Junior Member
transaction will help when data is being inserted/updated or deleted. but what do you do when data is being selected ?
-
Dec 13th, 1999, 09:33 AM
#7
I don't know your specific application's needs, but if my user doesn't want to wait for normal processing (fooling around with the X), then he/she probably doesn't want to commit the transaction either. Your original post said , "update", but anything within the transaction is taken as a group or the group is not taken with a Rollback.
If it really is just a select, then why do you care about the X ?
Begin Transaction
Select * From MyTable
Commit Transaction (if window is still alive, else rollback)
...is valid anyway.
-
Dec 15th, 1999, 01:05 AM
#8
Lively Member
ghost...i don't know if you saw this (i missed mit my first time trying to run this piece of code) but you have to use the InsertMenu function instead of the RemoveMenu function WITH the MF_INSERT parameter in order to re-insert the "X" into your program. it should work fine then. any other problems try e-mailing me with specifics and i will see what's going on...
hope this helps. happy programming!!
--michael
[email protected]
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
|