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 7532155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:22:11+00:00 2026-05-30T05:22:11+00:00

I am having trouble trying to hard encode a text document into my C#

  • 0

I am having trouble trying to hard encode a text document into my C# forms application. Basically I have webpage HTML that I want to populate into a text box. I can easily do this with stream reader or spend forever writing it into a string. Looking around at the different element I can add to my solution was a textfile.

So I am looking for an easy way to tell my application to read a text file or something similar and put it in the text box. So far I can’t figure out how to reference the text file I added to the form.

I want this coded into the exe as a default document. I don’t want an external file so that it cant be edited and so that the program becomes easily portable.

Any suggestions on how to internally embed this file and access it like a class or something?

  • 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-05-30T05:22:13+00:00Added an answer on May 30, 2026 at 5:22 am

    Right click on your project and click properties. You get the usual screen with lots of tabs on the left. Click the one that says “Resources”. You can add strings and other things, but you can also add text files.

    Change the dropdown at the top to files, then click “Add Resource.” Browse to a text file, name it whatever. This will add the file into your assembly. Don’t get too excited because this can be decompiled so don’t store any secret messages anon.

    You can do this in a .net site, mvc site, console app, etc. The code below is console app style to keep it simple. Granted, this is just a text file, but it gives you the basics of using resources. You could expand this to other types of files, including 3rd part stuff like report templates, format files, xml, and other things that otherwise might be clumsy to always try ensure are included in your config when you promote your code. Downside, you have to recompile to make changes.

    using System;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                var output = Properties.Resources.helloword;
                Console.WriteLine(output);
                Console.ReadLine(); //just so you can see it
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble trying to convert a text file into a list of lists
I am having trouble trying to print a table in HTML so that the
I am having trouble trying to get iterators for inner sub-containers. Basically imagine this
I'm currently trying to design an application and I'm having trouble trying to decide
I'm having trouble trying to put a ProgressDialog into my app. In my GameEngine
I've been having trouble trying to communicate between PHP and my iOS application using
I`m having trouble trying to optimize this query with OVER (PARTITION BY ...) because
I'm having trouble trying to optimize the following query for sql server 2005. Does
I'm having trouble trying to set the value of a property after i cast
I am having trouble trying to connect an Infopath 2007 form to an WCF

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.