hi guys just need some help in creating a sign up button or a register button and the code inside it. I already created a login form complete with username and password, problem is I do not know how I can create a login for it. I mean it's just a form that doesn't function, only thing it has right now is an exception handler ready incase an unregistered username and password is enter. any idea how I can make one? It has something to do with databases right? Help me plss. and here is my code, it was declared in my MainForm.cs Class, take not it is just a class, it is not the actual main class(the ones with static void main() that calls classes).
public void LogInButtonClicked(object source, EventArgs e)
{
// First, clear the fields reflecting the
// previous student's information.
ClearFields();
// Display password dialog
passwordDialog = new PasswordForm();
passwordDialog.ShowDialog(this);
string password = passwordDialog.Password;
string id = passwordDialog.Id;
passwordDialog.Dispose();
// We'll try to construct a Student based on
// the id we read, and if a file containing
// Student's information cannot be found,
// we have a problem.
currentUser = new Student(id + ".dat");
currentUser.ReadStudentData(schedule);
// Test to see if the Student fields were properly
// initialized. If not, reset currentUser to null
// and display a message box
if (!currentUser.StudentSuccessfullyInitialized())
{
// Drat! The ID was invalid.
currentUser = null;
// Let the user know that login failed,
string message = "Invalid student ID; please try again.";
MessageBox.Show(message, "Invalid Student ID",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
// We have a valid Student. Now, we need
// to validate the password.
if (currentUser.ValidatePassword(password))
{
// Let the user know that the login succeeded.
string message =
"Log in succeeded for " + currentUser.Name + ".";
MessageBox.Show(message, "Log In Succeeded",
MessageBoxButtons.OK, MessageBoxIcon.Information);
// Load the data for the current user into the TextBox and
// ListBox components.
SetFields(currentUser);
}
else
{
// The id was okay, but the password validation failed;
// notify the user of this.
currentUser = null;
string message = "Invalid password; please try again.";
MessageBox.Show(message, "Invalid Password",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
// Check states of the various buttons.
ResetButtons();
}