Hi All

I have just one question..

I have an application, at the login screen I have a check box where the user can select if he/she is the default user on the computer he/she is using.

What I would like to do is create a text file with the username in and when the application is started on the pc it calls that file and automatically assigns the default user (To make it user friendly :))

How would I go about to do this?

You could also make a login field in your settings file to store it.

I read the article. Very interesting I must say, but that's not quite what I'm looking for. If I can save it in a text file, or perhaps indeed a login field it would be great, but how to go about and get started?

Since you rejected the text file that is user and application settings, I'm not sure what it is that you want.

// Get the first line of a text file only
string userid = File.ReadAllLines("SomeFilePath")[0];

// Write a single line to a text file
File.WriteAllLines("SomeFilePath", new String[] {userid});

I read the article. Very interesting I must say, but that's not quite what I'm looking for. If I can save it in a text file, or perhaps indeed a login field it would be great, but how to go about and get started?

How are you trying to implement it then, if this isn't what you're looking for?

I read Momerath's quoted article and now have used settings in my own applications for the first time (with great success I should add too). Why can't you just have a defaultUser setting that stores the userid of the user? If you use user settings instead of application settings (as explained in the article above) all configurations are saved in a file called "User.config" which is just basically the text file you're looking for... I would think.

This question has already been answered. Start a new discussion instead.