In many cases, a dialog needs to return a significant amount of information to the calling mechanism. Unfortunately, the method Dialog.show() is declared as void and does not return any data.
If, when implementing a dialog, results from the dialog are needed, the recommended way to get those is by doing the following tasks:
Extend the DialogResult class to contain references and additional data needed by the dialog and/or returned by the dialog.
Before creating the dialog, create an instance of the DialogResult class.
Ensure that the dialog has at least one constructor that accepts an instance of a DialogResult object.
In the constructor for the dialog class derived from StandardDialog, pass the DialogResult object to the correct StandardDialog constructor.
During the handling of the OK button, set the results back into this instance.