Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Remember username or password for login form [duplicate]

I have created a sample Login form in C# Windows Form Application and what I want is to add Remember username or password feature to my login form.

I just need to provide my username, cause it will remember my password and automatically fill in the password field (Ex. Like in gmail auth).

How could I achieve that?

This is my Login form app:- http://i50.tinypic.com/2pzxjb7.jpg

like image 476
Smith Avatar asked Sep 21 '12 23:09

Smith


Video Answer


1 Answers

I solved using that.

In you winforms project right click and go to properties, select settings and add name to store data (eg. userName and passUser)

So in you login form add a checkbox remember me.

In you button loggin check if checkbox true, save user and pass

        if (checkRemember.Checked)
        {
            Properties.Settings.Default.userName = textBoxUserName.Text;
            Properties.Settings.Default.passUser = textBoxUserPass.Text;
            Properties.Settings.Default.Save();
        }

In you load login form add this

        if (Properties.Settings.Default.userName != string.Empty)
        {
            textBoxUserName.Text = Properties.Settings.Default.userName;
            textBoxUserPass.Text = Properties.Settings.Default.passUser;
        }

Regards.

like image 195
Lrodriguez84 Avatar answered Sep 21 '22 04:09

Lrodriguez84