Substitute of Msgbox (DialogForm)


Licensed User
A simple way for user interaction is by the Msgbox function. However, this has some drawbacks as it allows only a certain button text (yes, no, OK, cancel..) and has a small button size.

In rough outside environments you may want the user not having to take the stylus (otherwise it is difficult to press the small buttons) but instead offer a simple full-screen dialog by way of a form having 2 (or some more) large buttons which can be pressed by hand, these buttons further having helpful information text.

I was not able to program such a dialog which should be as simple as the MsgBox feature and used the same way. In the example I have placed a MsgBox to show the current system. In the line ***** now marked as comments I have placed the desired sub call. But it appears there is no possibility to halt the program within DialogForm and wait for the button pressing event and then return the button number (e.g. as in MsgBox number 6 for the first and 7 for the second button) to the main program. I am aware that there are other ways to handle the problem for a specific case simply by putting the "If BtnPressed=6 Then" part from App_Start to Btn_Click but I am looking for a way to use such MsgBox-substitutes in more places so it must be generalized.
Can anyone help me?



Licensed User
Hello miklquick
Try the program below, I think it is what you are looking for.
Of course there are different ways to program it, this is one.
You can adapt it to your application

The return value of first button in the MsgBox is not 6.
The 6 means that the 'Yes' button was pressed, this is only valid if you select cMsgBoxYesNo or cMsgBoxYesNoCancel.
With the MsgBox you should better use the constats cYes, cNo etc.
If you select for example cMsgBoxAbortRetryIgnore the return value of the first button will be cAbort = 3

I hope this helps you, best regards




Licensed User
Thank you Klaus and Erel for your quick replies. Both solutions enable a general DialogForm.

Klaus: Your do-loop (lines 73-75) was the inspiration which I didn´t have. Thanks a lot. I now enclose my final version of what I was looking for which is based on your idea.

One essential point for me was the possiblity to use DialogForm just as simple as MsgBox, namely within a subroutine (i.e. that execution of the program continues in the same sub !) and the possibility to evaluate the Dialog result with an If..Then block. This is now possible.

Erel: Thanks too. The only drawback is that as result of the dialog you do not get back to the calling sub but you branch off into alternative subs which I wanted to avoid.