Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
912
webdialogwindow as msgbox replacement
posted

I'm trying to use WDW as a replacement for the Windows Forms Msgbox.  I've seen the great videos on WDB from Craig Shoemaker, but his examples are fairly simple, and the WDW display is the last thing done before the end of the routine.  In real life you may want to ask a question via a WDW and continue processing based on the answer given in the WDW.    Basically I want to use WDW to somehow accomplish what msgbox does in the following simple example.

public sub MySub()

If Msgbox("do you want to delete the record") = vbYes then

       delete the record

else

     dont delete the record

endif

Continue to do other things

end sub

By using WDW and setting some Session variables and then having a button in the WDW execute the MySub routine all over again from the beginning, I've gotten pretty close to doing what I want.  However, it is VERY cumbersome and certainly not what I consider clean code.  It's just a kludge. 

A few questions about WDW:

1. it appears to be asynchronous.  That is, the server code continues to run after the call to display the WDW, so I can't really code in a "test" for a value that is being set in the WDW control.  For example, if I set the session variable "DeleteIt" via clicking a button in the WDW I can't do something like this:

display WDW and set the "deleteIt" flag

If session("deleteIt") is true then ...whatever......

because it seems like the "If session" line is being executed immediately after the WDW display and before the user exits the WDW., even if the WDW is set to modal.

So to get around that I'm setting and testing a bunch of flags to basically get me back to the line of code "If session..." when I re-execute the Sub via a button click in the WDW.

So, my question to all you WDW experts is how to do this a better way. What is the best way to continue executing the Sub from the line of code immediately following the WDW display but after the WDW closes.  If this can somehow be easily done it would then be easy to simulate the MsgBox functionality.

Hope this is clear.  Thanks in advance for any advice.