MessageBox - File exists

W

W. Danner

Hello,
I will need to download an ebook about C#, but am I allowed to ask a
question right away?
This code throws a compiler error:

System.Windows.Forms.MessageBox.Show (System.IO.File.Exists("myfile.txt"));

Can somebody please tell me how it's done correctly?
I would like to show a messagebox that tells me if this file exists. I
do not want to write the full path, but I would like to know if my
application finds the file right away...

Thank you
Will
 
F

fd123456

Hi Will,

Try this :

System.Windows.Forms.MessageBox.Show
(System.IO.File.Exists("myfile.txt").ToString());

HTH,

Michel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top