blah blah blah is here! blah blah » Close

up1down
link

I want to do something like this:

.
.
if(ShowDialog(MessageBox.Show("File already Exists, do you want to overwirte the existing file?","File Overwrite???", MessageBoxButtons.YesNo))=="Yes")
.
.


MessageBox says: The file already exists" Do you want to overwite? Yes/No. and if user presses Yes then the process should overwrite the file otherwise... exits.

last answered one year ago

1 answers

up2down
link

Like this perhaps:

DialogResult dr = MessageBox.Show("File already Exists, do you want to overwirte the existing file?","File Overwrite???", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
// code to overwrite file
}

Feedback