Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8117749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:16:29+00:00 2026-06-06T04:16:29+00:00

I added a text file to my solution in VS2010 and called it test.txt.

  • 0

I added a text file to my solution in VS2010 and called it test.txt.

In the properties of the file I have set copy to output : always and the build action : content.

How can I open this file in my project now? So that if a user presses a button it will open up the text file.

I have tried several methods, such as File.open("test.txt") and System.Diagnostics.Process.Start(file path)) and nothing has worked.

Can anyone offer up some suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:16:31+00:00Added an answer on June 6, 2026 at 4:16 am

    Since you are using copy to output the file is being placed in the same directory as your program therefore you can use:

    System.Diagnostics.Process.Start("test.txt");
    

    or based on this MSDN article:

    string path = "test.txt";
    using (FileStream fs = File.Open(path, FileMode.Open))
    {
        byte[] b = new byte[1024];
        UTF8Encoding temp = new UTF8Encoding(true);
    
        while (fs.Read(b, 0, b.Length) > 0)
        {
            textBox1.Text += (temp.GetString(b));
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple text file with extension .txt added to my solution with
I am making text editor in netbeans and have added jMenuItems called Copy,Cut &
Say I have a file, myfile.txt. It has a paragraph of text in it,
I added a text file to a testapp's solution and I want to read
I'm working in Visual Studio 2005 and have added a text file that needs
I have a tableview with a navigation bar at the top. I've added text
I have a View where some input text to be added dynamica using jquery,
I have a text file with two non-ascii bytes (0xFF and 0xFE): ??58832520.3,ABC 348384,DEF
I want to read the first line of a text file that I added
Hi I have 2 local branches - master and test . I added a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.