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?
I’m building a typing application, and would like to add text files containing various
Share
Project Resource (Resx) Version:
This version is slightly easier to work with for your example!
Now to access this file simply use something like…
Note: You don’t need the extension, and this will be strongly typed also!
Embedded Resource Version:
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.
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;
Taken from: http://www.vb-helper.com/howto_net_embedded_resources.html