Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

process.start("winword", filename) can not open file with space in the path and name

$
0
0

Hi,

I am trying to write a class which can open file with selected application. for simplicity, now I just hard code the varaibles.

the problem: if the path or file name has space in it, even it exist, winword still can not open it.

could someone kindly show me what I did wrong and how to do it properly.

Thanks in advance.

 

Belinda

________________

 

publicstaticclassFileOpen

{

publicstaticvoid info()

{

string path = @"c:\a temp folder\aaa 1.txt";

if (File.Exists(path))

    // the file I am using in the sample does exist

     MsgBox.info("yes");

}

else

{

     MsgBox.info("no");

}

// working

//Process.Start("winword", "c:\\aaa.txt");

 

// not working

//Process.Start("winword", "c:\aaa.txt");

 

// not working

Process.Start("winword", "c:\\a temp folder\\aaa 1.txt");

 

// not working

Process.Start("winword", path);

Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>