TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
20
9.3k
how to change the value of a variable in a running program and save it for futute use
Jun 24 2012 8:26 AM
I want the user to be able to change his or her password after logging in to a Windows program and then save the new password for future sessions.
The code for the log in screen is:
public partial class Form1 : Form
{
Authenticator auth = new Authenticator();
public Form1()
{
InitializeComponent();
}
private void btnLogIn_Click(object sender, EventArgs e)
{
string existingPassword = txtEnterPassword.Text;
if (existingPassword == auth.Password)
{
MessageBox.Show("Password accepted. You may log in");
}
else
MessageBox.Show("Password faild. Log in refused");
}
private void btnChangePassword_Click(object sender, EventArgs e)
{
string existingPassword = txtEnterPassword.Text;
string newPassword = txtChangePassword.Text;
if (existingPassword == auth.Password)
{
auth.Password = newPassword;
MessageBox.Show("Password changed. You may now use it to log in");
}
else
MessageBox.Show("Password was not changed.");
}
The code for the Authenticator class is:
public class Authenticator
{
private string password = "123Really";
public string Password
{
get { return password; }
set { password = value; }
}
Any helpful suggestions would be appreciated
Reply
Answers (
3
)
How to design the Company Survey form?
my application and database