0

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?

5
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by TheDocterd
0

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

0

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?

0

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});
0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.