user1281991
user1281991

Reputation: 773

Save data in Users/NAME/Roaming/AppData?

Pretty new to C# but not new in programming in generally.

I'm still trying to figure out how best practice is when a program has to save inputs from the user.

Let's say that I have a very simple Visual C# Windows Form program containing:

User can enter text in the textfield, and when pressing the Add button the program is saving the entered the text (somewhere and somehow). And the saved text is showed in the listbox. (Let's say a user does this 10 times. So the listbox helds 10 entrys with text from the textfield).

HOW is the best practice to do this? XML? txt file? Having a database running on the computer is not an option. It has to work on every WinXP/Win7 machine and it can't have any dependencies. Just install the program and it has to work.

Hope that you understand my questions.

Upvotes: 1

Views: 3950

Answers (1)

SLaks
SLaks

Reputation: 887345

You can create an XML file or a SQL CE database in

Path.Combine(
    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
    @"Your App Name\Data.xml"
)

Upvotes: 2

Related Questions