This question actually originates from a Visual Basic course I'm taking, but I think it can be answered here.
DialogResult is an object that MessageBox returns when the user clicks the yes or no button.Code:Dim WhichButtonDialogResult As DialogResult WhichButtonDialogResult = MessageBox.Show(bunch of arguments with Yes and No buttons) If WhichButtonDialogResult = DialogResult.Yes Then 'Code... EndIf
This is my question (referring to the code in red). If objects have both methods and properties, then how can you simply test if a constant (DialogResult.Yes) is equal to the entire object?
I would expect something like
Instead.Code:If WhichButtonDialogResult.Result = DialogResult.Yes