AnsweredAssumed Answered

How to check the return of ShowDialog()

Question asked by DMan on Dec 17, 2009
Latest reply on Dec 18, 2009 by DMan
I am trying to build a VEE program where I use a .NET FolderBrowserDialog.  after creating an instance of the FolderBrowserDialog object, I use the ShowDialog() method to display the dialog and when I click OK or Cancel in the dialog I can see that the return value is either System.Windows.Forms.DialogResult(OK) or System.Windows.Forms.DialogResult(Cancel).  In other .NET languages you can simple compare the return value to System.Windows.Forms.DialogResult.OK to see if the user clicked OK or Cancel, but the IF/Then/Else or the triadic in VEE won't let me use a "==" operator on a variable of type object.  In all the examples in the help or example directory where a ShowDialog() is used, the example writers conveniently ignored the method's return value and just assumed the user would always click ok and they simply looked at the selected folder or file property right after the ShowDialog().

It is possible to check the SelectedPath for an empty string (""), but I still would like to know how to check the return value of ShowDialog() directly for cases where the dialog may have more than 2 possible results.