 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Get the path in c#</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/</link>
	<description></description>
	<lastBuildDate>Sun, 19 May 2013 03:14:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/#comment-75355</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Tue, 30 Mar 2010 14:51:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-75355</guid>
		<description><![CDATA[Ellie, to summarize:

If you are constructing your fileName variable this way:

fileName = System.Windows.Forms.Application.StartupPath + “jrn\mayo_stmt_jrn.txt”

Then the &quot;\jrn\&quot;  subdirectory must exist in the path where you are running the application from, so, if you run your application from the IDE, it will run from either \bin\debug or \bin\release, so you have to create your \jrn\ subdirectory under those paths.  If you are going to copy your executable program to another path, then you have to create the \jrn\ subdirectory under the path where your application has been copied to.]]></description>
		<content:encoded><![CDATA[<p>Ellie, to summarize:</p>
<p>If you are constructing your fileName variable this way:</p>
<p>fileName = System.Windows.Forms.Application.StartupPath + “jrn\mayo_stmt_jrn.txt”</p>
<p>Then the &#8220;\jrn\&#8221;  subdirectory must exist in the path where you are running the application from, so, if you run your application from the IDE, it will run from either \bin\debug or \bin\release, so you have to create your \jrn\ subdirectory under those paths.  If you are going to copy your executable program to another path, then you have to create the \jrn\ subdirectory under the path where your application has been copied to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ellie</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/#comment-75350</link>
		<dc:creator>ellie</dc:creator>
		<pubDate>Tue, 30 Mar 2010 14:04:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-75350</guid>
		<description><![CDATA[Here is how I populate variable fileName:
fileName = System.Windows.Forms.Application.StartupPath + “jrnmayo_stmt_jrn.txt”; 
file mayo_stmt_jrn.txt in under folder jrn under the solution.
When I trace the program fileName gets the following value. I could send you a snapshot of the program if I had your email address. I don&#039;t know if I could do it here on this site!

“C:Documents and SettingselhamMy DocumentsVisual Studio 2005ProjectsCDProgramCDProgrambinDebugjrnmayo_stmt_jrn.txt”
Thanks,
Ellie]]></description>
		<content:encoded><![CDATA[<p>Here is how I populate variable fileName:<br />
fileName = System.Windows.Forms.Application.StartupPath + “jrnmayo_stmt_jrn.txt”;<br />
file mayo_stmt_jrn.txt in under folder jrn under the solution.<br />
When I trace the program fileName gets the following value. I could send you a snapshot of the program if I had your email address. I don&#8217;t know if I could do it here on this site!</p>
<p>“C:Documents and SettingselhamMy DocumentsVisual Studio 2005ProjectsCDProgramCDProgrambinDebugjrnmayo_stmt_jrn.txt”<br />
Thanks,<br />
Ellie</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/#comment-75306</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Mon, 29 Mar 2010 22:08:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-75306</guid>
		<description><![CDATA[What&#039;s in your &#039;fileName&#039; variable ?

That error occurs when you are looking for a file in path that doesn&#039;t exist.]]></description>
		<content:encoded><![CDATA[<p>What&#8217;s in your &#8216;fileName&#8217; variable ?</p>
<p>That error occurs when you are looking for a file in path that doesn&#8217;t exist.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ellie</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/#comment-75303</link>
		<dc:creator>ellie</dc:creator>
		<pubDate>Mon, 29 Mar 2010 20:13:04 +0000</pubDate>
		<guid isPermaLink="false">#comment-75303</guid>
		<description><![CDATA[it doesn&#039;t even let me run the program from the application. I get an error that says &#039;could not find a part of the  path&quot;  when I am trying to read the file
 System.IO.StreamReader objReader = new System.IO.StreamReader(fileName);
So I am not able to trace the program!

Thanks,
Ellie]]></description>
		<content:encoded><![CDATA[<p>it doesn&#8217;t even let me run the program from the application. I get an error that says &#8216;could not find a part of the  path&#8221;  when I am trying to read the file<br />
 System.IO.StreamReader objReader = new System.IO.StreamReader(fileName);<br />
So I am not able to trace the program!</p>
<p>Thanks,<br />
Ellie</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/#comment-75302</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Mon, 29 Mar 2010 19:58:13 +0000</pubDate>
		<guid isPermaLink="false">#comment-75302</guid>
		<description><![CDATA[Hi Ellie.

It doesn&#039;t add \bin\debug to the path.  When you run your application from the IDE, it in fact is running from either \bin\debug or \bin\release (depending on your active configuration).

Try copying your exe to another location, and run it from there.]]></description>
		<content:encoded><![CDATA[<p>Hi Ellie.</p>
<p>It doesn&#8217;t add \bin\debug to the path.  When you run your application from the IDE, it in fact is running from either \bin\debug or \bin\release (depending on your active configuration).</p>
<p>Try copying your exe to another location, and run it from there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ellie</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/#comment-75299</link>
		<dc:creator>ellie</dc:creator>
		<pubDate>Mon, 29 Mar 2010 18:38:50 +0000</pubDate>
		<guid isPermaLink="false">#comment-75299</guid>
		<description><![CDATA[I am looking for the current path. I am writing an application which is going to be run from a CD (publish to a CD). Added folders under the solution/project. Like we have bin folders in asp.net.
When I run the program  string fileName = System.Windows.Forms.Application.StartupPath + &quot;\jrn\mayo_stmt_jrn.txt&quot;;  fileName gets the following value:

&quot;C:\Documents and Settings\elham\My Documents\Visual Studio 2005\Projects\CDProgram\CDProgram\bin\Debug\jrn\mayo_stmt_jrn.txt&quot;
I am wondering why it adds \bin\debug to the path? How can I get the current path???
Thanks,
Ellie]]></description>
		<content:encoded><![CDATA[<p>I am looking for the current path. I am writing an application which is going to be run from a CD (publish to a CD). Added folders under the solution/project. Like we have bin folders in asp.net.<br />
When I run the program  string fileName = System.Windows.Forms.Application.StartupPath + &#8220;\jrn\mayo_stmt_jrn.txt&#8221;;  fileName gets the following value:</p>
<p>&#8220;C:\Documents and Settings\elham\My Documents\Visual Studio 2005\Projects\CDProgram\CDProgram\bin\Debug\jrn\mayo_stmt_jrn.txt&#8221;<br />
I am wondering why it adds \bin\debug to the path? How can I get the current path???<br />
Thanks,<br />
Ellie</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saurabhdamle</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/#comment-75257</link>
		<dc:creator>saurabhdamle</dc:creator>
		<pubDate>Sat, 27 Mar 2010 07:48:29 +0000</pubDate>
		<guid isPermaLink="false">#comment-75257</guid>
		<description><![CDATA[Are these both folders are under same folder?
If they are then you can store the path in &quot;app.config&quot; file of  your application.
While giving the path in code, you can get the path from config file and concatenate the folder name for pdf files and text files.

You can get the path from app.config file as follows:
Configuration.ConfigurationSettings.AppSettings(&quot;Attribute Name&quot;)

Regards,
Saurabh]]></description>
		<content:encoded><![CDATA[<p>Are these both folders are under same folder?<br />
If they are then you can store the path in &#8220;app.config&#8221; file of  your application.<br />
While giving the path in code, you can get the path from config file and concatenate the folder name for pdf files and text files.</p>
<p>You can get the path from app.config file as follows:<br />
Configuration.ConfigurationSettings.AppSettings(&#8220;Attribute Name&#8221;)</p>
<p>Regards,<br />
Saurabh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bobbeechey</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-the-path-in-c-sharp/#comment-75256</link>
		<dc:creator>bobbeechey</dc:creator>
		<pubDate>Sat, 27 Mar 2010 06:47:01 +0000</pubDate>
		<guid isPermaLink="false">#comment-75256</guid>
		<description><![CDATA[I am not sure what you are looking for. The path you quote (apart from missing &quot;&quot; symbols) is certainly &quot;below&quot; the project while developing. You should probably, in the final release, use the System.IO.Path class to combine the string provided by the System.Windows.Forms.Application.StartupPath property with your desired path information to provide an absolute path to use with your StreamReader.]]></description>
		<content:encoded><![CDATA[<p>I am not sure what you are looking for. The path you quote (apart from missing &#8220;&#8221; symbols) is certainly &#8220;below&#8221; the project while developing. You should probably, in the final release, use the System.IO.Path class to combine the string provided by the System.Windows.Forms.Application.StartupPath property with your desired path information to provide an absolute path to use with your StreamReader.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.012 seconds using memcached
Object Caching 366/369 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-20 00:32:53 -->