473,767 Members | 2,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot access project text files in VS2005

GT
Consider a WindowsApplicat ion 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.NewFolde r.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.ReadAllTex t() 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.ReadAllTex t("C:\\....") is not an option since this of course
will stop working once the project is moved).
Feb 16 '06 #1
1 1292
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 WindowsApplicat ion 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.NewFolde r.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.ReadAllTex t() 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.ReadAllTex t("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
4753
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 appreciated. Thanks in advance
4
2889
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 our current extensive number of .Net 1.1 web apps convert to it. After a week's time I dont's mind the converted app code that was broken and had to be changed, due to deprecation, new framework classes (some of which have names identical to...
11
1305
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 or namespace 'MyUserControl' does not exist in the namespace 'The.Correct.Namespace' (are you missing an assembly reference?)" even though the user control in question is named 'MyUserControl' and is explicitly wrapped in the namespace block...
4
3102
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 projects that there are a lot of unimportant files (vbw, exe, obj, ...) . But I don't know which of the VB-VS2005 files are similar. So can anyone give me some hints please? So far I have the following files: ..resx ..exe
5
2221
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 do I setup VS2005 to see the solution node after I create the first project without adding the second project in the same solution? Thanks
12
2121
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 server - Version Information: ASP.NET Development Server 8.0.0.0, instead of IIS. This is a serious problem. How does one get an Access database on the web, using one's own computer(I have windows xp pro).
6
3377
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) I installed FrontPage server extensions to IIS on my computer while following instructions in a Microsoft ASP.Net MCSD training book. After installing the FrontPage Server Extensions I cannot create a new
2
5787
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 function in the previously 6.0 code and I get the error noted below. What I don't understand is since I created this cpp as a new file in .net and inherited from a .net base class then why would I get this error? Both the class and base class to me...
19
1885
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, but it has to be easy to deploy the application (precompiled, I don't want to give away my source)
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8835
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.