Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in documentation, or bug in .NET

I recently was looking up how to open a file browser dialog box, when I came across this documentation. Now, looking down at the example, it shows:

if(openFileDialog1.ShowDialog() == DialogResult.OK)

However, if I type that out, Intellisense doesn't recognize the OK. In fact, its not even an option. I'm having to use :

if(openFileDialog1.ShowDialog() == true)

Am I missing something stupid, or is this an oversight in the documentation?

like image 801
PiousVenom Avatar asked Dec 05 '22 10:12

PiousVenom


1 Answers

You're looking for the documentation for the Windows Forms Form.ShowDialog method.

I suspect you're actually using WPF, where Window.ShowDialog returns a Nullable<bool>.

like image 156
Jon Skeet Avatar answered Jan 20 '23 06:01

Jon Skeet