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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:21:34+00:00 2026-06-18T07:21:34+00:00

I’m building a typing application, and would like to add text files containing various

  • 0

I’m building a typing application, and would like to add text files containing various commonly used words to the project, which can later be read from. However, when I go to Project -> Add Existing Item, there is only the option to add VB code files to the project. Is there a way to add text files to the project, or will I have to import the data from the file at runtime?

  • 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-18T07:21:35+00:00Added an answer on June 18, 2026 at 7:21 am

    Project Resource (Resx) Version:

    This version is slightly easier to work with for your example!

    • Right Click on your project
    • Select Properties
    • Goto the Resources Section
    • You will see a drop down in the top left corner of the Resources Secion, shown in the Screenshot below.
    • Select “Files” from the DropDown.
    • Click the Add Resource Button.
    • A Select File Dialog box will be shown.
    • Select your file
    • Save Your Project

    Resx Resources

    Now to access this file simply use something like…

    Dim content As String = My.Resources.mytextfile
    

    Note: You don’t need the extension, and this will be strongly typed also!

    Embedded Resource Version:

    • Right Click on your Project.
    • Goto Add->Existing Item.
    • At the bottom right will be a dropdown (Next to the filename).
    • Select “All Files (*.*)”
    • Browse to your files’ location.
    • Add the File.

    Select All Files

    Once you have added you file(s), selecting the file(s) in the solution explorer window will allow you to select their “Build Action”. You can select either Content, or Embedded Resource from the options.

    • Content: Allows you to retrieve a file (in same dir as assembly) as a stream via Application.GetContentStream( uri ). For
      this method to work, it needs a AssemblyAssociatedContentFile
      custom attribute which VS graciously adds when you mark a file as
      “Content”
    • Embedded resource: embeds the file in an exclusive assembly manifest resource.

    Taken from; https://stackoverflow.com/a/145769/1305169

    If you select Embedded Resource, then to read your text file, you can use code such as;

    Dim executing_assembly As System.Reflection.Assembly = _
        Me.GetType.Assembly.GetEntryAssembly()
    
    ' Get our namespace.
    Dim my_namespace As String = _
        executing_assembly.GetName().Name.ToString()
    
    ' Load a text file.
    Dim text_stream As Stream = _
        executing_assembly.GetManifestResourceStream(my_namespace _
        + ".text1.txt")
    If Not (text_stream Is Nothing) Then
        Dim stream_reader As New StreamReader(text_stream)
        Label1.Text = stream_reader.ReadToEnd()
        stream_reader.Close()
    End If
    

    Taken from: http://www.vb-helper.com/howto_net_embedded_resources.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to run a str_replace or preg_replace which looks for certain words
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace

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.