Click to See Complete Forum and Search --> : How can i define the define the diffrence betwen FileDialog's OK click or Cancel clic


dahwan
September 19th, 2007, 06:20 AM
How can i define the define the diffrence betwen FileDialog's OK click or Cancel click?

All it has is "Apply_Click", which doesnt cover OK click. There is no way to define if i have clicked OK or Cancel =0

Plz help

Thx in advance

Thread1
September 19th, 2007, 06:51 AM
FileDialog is an abstract class, perhaps you are referring to OpenFileDialog/SaveFileDialog..? if i understood you correctly you would like to determine if the Ok or the Cancel button was clicked..


OpenFileDialog f = new OpenFileDialog();
if (f.ShowDialog(this) == DialogResult.OK)
MessageBox.Show("Ok button clicked!");
else
MessageBox.Show("Cancel button clicked!");
f.Dispose();

dahwan
September 19th, 2007, 12:50 PM
Ok, thanks! :D