How Can An Entire Object be Compared to a Single Constant?
This question actually originates from a Visual Basic course I'm taking, but I think it can be answered here.
Code:
Dim WhichButtonDialogResult As DialogResult
WhichButtonDialogResult = MessageBox.Show(bunch of arguments with Yes and No buttons)
If WhichButtonDialogResult = DialogResult.Yes Then
'Code...
EndIf
DialogResult is an object that MessageBox returns when the user clicks the yes or no button.
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
Code:
If WhichButtonDialogResult.Result = DialogResult.Yes
Instead.