468,765 Members | 1,196 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

How to open a file that contains some other extension like(.mxd) when button is click

1
How to open a file that contains some other extension like(.mxd) when button is click
Dec 12 '10 #1
2 2127
How about trying FileStream class?
Expand|Select|Wrap|Line Numbers
  1. using System.IO;
  2.  
  3. FileStream fileStream = new FileStream(@"c:\file.txt", FileMode.Open);
  4. try
  5. {
  6.   // read from file or write to file
  7. }
  8. finally
  9. {
  10.   fileStream.Close();
  11. }
  12.  
Dec 14 '10 #2
Expand|Select|Wrap|Line Numbers
  1. private void OpenAsProcess(string path)
  2. {
  3.     if (!string.IsNullOrEmpty(path))
  4.     {
  5.         try
  6.         {
  7.             Process.Start(new ProcessStartInfo(path));
  8.         }
  9.         catch (Exception e)
  10.         {
  11.             Console.WriteLine(e.Message);
  12.         }
  13.     }
  14. }
  15.  
Dec 15 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Bruce B | last post: by
1 post views Thread by Seok Bee | last post: by
8 posts views Thread by Deft.Jab | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.