views:

72

answers:

2

Is it possible to set the OpenFileDialog's cancel button enable = false? If so, How?

I'm using winforms

Edit

OpenFileDialog file_open_dialog = new OpenFileDialog();
+3  A: 

I don't believe so, and with good reason! Are you sure that you want to disable the Cancel button? Being that this is a modal dialog this would prevent the user from continuing (and hence making your application unusable) until they selected a file - there are almost certainly going to be scenarios where this simply isn't possible, or the user doesn't want to be forced into saving a file.

Of course I could be wrong and there could be a completely legit scenario that I'm not aware of - however I'm afraid that Microsoft were also unaware of this scenario and so the OpenFileDialog doesn't support disabling the cancel button.

I'm afraid that if you really don't want a cancel button you will need to create your own clone of the dialog.

Kragen
Definitely a usability issue. +1
rahul
+1  A: 

You probably want to check out these articles:

http://www.codeproject.com/KB/dialog/CustomizeFileDialog.aspx

http://msdn.microsoft.com/en-us/library/ms996463.aspx

http://www.codeproject.com/KB/dialog/OpenFileDialogEx.aspx

Pedery
Why the downvote?
Pedery
downvoters please mention the reason
Pramodh
Thanks for these articles
Rye