I am using timed infoboxes to Keep the user updated as their records are inserted into the database, and am using the following Sub to create a timed infobox. It works exactly as I would like, but I am just now realizing that MessageBoxes Will not work for internet applications. I can't decide if the InfoBox Will or won't work over the internet, it seems like it probably will, but I'm really not sure. I had a horrible time trying to do Async in order to update a label. This seems by far the easiest solution if it will actually display once everything is uploaded to the server.
Sub MessageBoxTimer(curRec As String, TotalRec As String)
Dim AckTime As Double, InfoBox As Object
InfoBox = CreateObject("WScript.Shell")
'Set the message box to close after 10 seconds
AckTime = 1
Select Case InfoBox.Popup("Updating Record " + curRec + " of " + TotalRec,
AckTime, "Scheduling all users", 1)
Case 1, -1
Exit Sub
End Select
End Sub
You have to adopt some client side code to do this.
I suggest adopting jquery.ui dialog. So, assuming you have jQuery installed (you need that), then also install jQuery.ui.
So, when we drop a button on a form, that button can have 2 events. One that will run the server side code (a post back), and then can ALSO have a client side (JavaScript) event that also runs.
Of course if the server side code runs real fast, then that dialog will not "appear" or show for much time.
So, you could say add a "dealy" to the server side code. In fact, doing so would then NOT require a timed dialog box, since when the code behind is done, the WHOLE browser page travels back from the server, re-loads, and refresh the page.
So, let's setup a fake delay, and pop a message box while the server side code runs.
In other words we "could" setup a timed box, but when the server side code is done, the box will close anyway.
So, say this simple markup:
So, you can put whatever you want into that div. When you have it all nice looking, then set display:none as per above.
Now, what JQuery.UI dialog will do for you is convert htat "div" into a dialog.
so, right below above markup, we have this:
And my code behind for this test button example:
and the result is now this: