Dom Beasley
Dom Beasley

Reputation: 55

Use embedded file from resources.resx in program

I have a program where it requires a text file to save some information, I have functions that currently use the path of the file then do stuff with it. However, I want to build the program into a .exe, but then the file is obviously not going to be in the same place. After research, I found using embedded resources allows me to add the text file to the program, but I can't seem to do anything with it. I have the "highscores.txt" in embedded files, and am currently using this:

string path = Resources.highscores;

However, this basically says that resources doesn't exit and I don't know what the problem is.

Upvotes: 2

Views: 191

Answers (1)

RichardMc
RichardMc

Reputation: 854

You can't change a file at run time if it's marked as an embedded file. Depending on what you are trying to save you could use the Settings file.

Upvotes: 1

Related Questions