Open file using OpenFileDialog

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm trying to load a word document from my dataBase, and then open it for
modifying.

I succeeded to get the file from the dataBase, and open it by
double-clicking on it.

but i can't open it using my application, here's my code:

openFileDialog1.FileName =
"D:\\Project\\WindowsApplication2\\WindowsApplication2\\bin\\Debug\\Doc.Doc";
openFileDialog1.OpenFile();

what's wrong \ missing so I will be able to open the file?

Thanks,
Gidi
 
Hi Gidi!
I succeeded to get the file from the dataBase, and open it by
double-clicking on it.

but i can't open it using my application, here's my code:

openFileDialog1.FileName =
"D:\\Project\\WindowsApplication2\\WindowsApplication2\\bin\\Debug\\Doc.Doc";
openFileDialog1.OpenFile();

what's wrong \ missing so I will be able to open the file?

The "OpenFile" method will return a Stream to the file and
don't open MS Word, like when you double-click on the file!
 
If you just want to open your WordDocument, i'd prefer
Process.Start(@"C:\YourWordFile.doc");
And YourWordFile.doc will be opened with the associated program.
 

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

Back
Top