Is there something similar to DialogResult from the dialog in VB6?

I have a VB6 form with buttons with the text “Continue” and “Cancel”. I want to check which one was pressed. In C #, each form has a dialog result, and I can set it before exiting the form, depending on which button was clicked. I do not see this in VB6.

Is there a result of the dialogue? If not the best practice for checking the result of the dialogue?

+4
source share
2 answers

To simulate the behavior of .net WinForms, you will need a helper function in your form code:

Public Function ShowDialog() As VbMsgBoxResult Me.Show vbModal ShowDialog = Iif(Cancelled, vbCancel, vbOk) Unload Me End Function 
+5
source

In VB6, a dialog usually returns an integer value that can match vbYes, vbNo, vbCancel, etc. See this article for more details: http://www.vb6.us/tutorials/understanding-msgbox-command-visual-basic

http://www.code-vb.com/fragments/Dialogs.htm#Msgbox OK-Cancel

You will need to specify it in your form if you created the form yourself.

The last answer in this post has a hint that might help: http://www.xtremevbtalk.com/archive/index.php/t-306663.html

0
source

All Articles