473,326 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Cannot access project text files in VS2005

GT
Consider a WindowsApplication in VS2005 named "MyApp". In addition to the
default "Resource" folder you create a new project folder named "NewFolder"
and add a text file in this folder named "TextFile1.txt" and a C# class named
"Class1.cs".
The project hierarchy would then look like this in the Solution Explorer:

======================
Solution 'MyApp'
-MyApp
...
+Resources
NewFolder
Class1.cs
TextFile1.txt
===============

The "Class1.cs" file (included in the project namespace) can be accessed by
typing 'MyApp.NewFolder.Class1', but how can the text file be accessed
without explicitly writing the entire file path?

For instanse, say you want to read the text in "TextFile1.txt" using the
File.ReadAllText() method. How can the file path passed to the ReadAllText()
method be expressed as a pointer to the text file included in the project ?
(writing File.ReadAllText("C:\\....") is not an option since this of course
will stop working once the project is moved).
Feb 16 '06 #1
1 1271
DWS
Sounds like you need a my documents open dialog box and let the user find the
textfile1.text

Good Luck
DWS
"GT" wrote:
Consider a WindowsApplication in VS2005 named "MyApp". In addition to the
default "Resource" folder you create a new project folder named "NewFolder"
and add a text file in this folder named "TextFile1.txt" and a C# class named
"Class1.cs".
The project hierarchy would then look like this in the Solution Explorer:

======================
Solution 'MyApp'
-MyApp
..
+Resources
NewFolder
Class1.cs
TextFile1.txt
===============

The "Class1.cs" file (included in the project namespace) can be accessed by
typing 'MyApp.NewFolder.Class1', but how can the text file be accessed
without explicitly writing the entire file path?

For instanse, say you want to read the text in "TextFile1.txt" using the
File.ReadAllText() method. How can the file path passed to the ReadAllText()
method be expressed as a pointer to the text file included in the project ?
(writing File.ReadAllText("C:\\....") is not an option since this of course
will stop working once the project is moved).

Feb 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
4
by: Brad | last post by:
I'm not one to rant or flame....so please excuse me while I do so for this once. I've now spent a bit of time working with VS2005 beta 2 to see how it functions for web development, especially how...
11
by: Greg Smalter | last post by:
I'm converting some ASP web projects from VS 2003 to VS2005/ASP 2.0. The worst problem I've run into is all references (in codebehind CS files) to UserControls fail. I get the error "The type...
4
by: Robert Schneider | last post by:
I'm using subversion. But I guess this is not important for the issue. So which files of a VB project should be (at least) under source control? Or which ones definitly not? I know from VB6...
5
by: kai | last post by:
Hi, I use XP Pro and VS2005. I find when I create a new Website, I only see the Project node not Solution. After I add sedcond project under the solution tree, then I see the solution node. How...
12
by: dennist685 | last post by:
How to get an Access database on the web from my own computer I have an Access database project in inetpub/wwwroot/Access2 . I build it, and then press cntrl-F5. - I still get the development...
6
by: JonSteng | last post by:
..Net Visual Studio Professional 2003 Version 7.1.3088 ..Net Framework 1.1 SP1 Version 1.1.4322 IIS 5.1 Windows XP Professional SP2 Micron T3000 Laptop (1.5 GHz; 1GB RAM; 40GB HD with 17GB Free)...
2
by: andy6 via DotNetMonster.com | last post by:
I took a c++ 6.0 project and converted it to c++ .net 2005 project. I want to make a web service out of it. One of the new files I created was a cpp where I have the webmethod pointing to a...
19
by: nyhetsgrupper | last post by:
Hi, Which project type do you prefer? Is the web site or web application project the best solution? The application I am about to write is completly new so migrating from vs 2003 is not an issue,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.