Click here to Skip to main content
16,006,362 members

Comments by Rajesh Nagaraj (Top 1 by date)

Rajesh Nagaraj 12-Jun-21 9:18am View    
Can You Please Help Me Where To Put The Above Code To Disable Hot Keys For My C# Form
This Helps Me For My Project.
Please Help Me, I'm A Newbie Here!!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;

namespace login_and_Register_System
{
public partial class frmRegister : Form
{
public frmRegister()
{
InitializeComponent();

}

readonly OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db_users.mdb");
OleDbCommand cmd = new OleDbCommand();
//readonly OleDbDataAdapter da = new OleDbDataAdapter();

private void button1_Click(object sender, EventArgs e)
{
if (txtUsername.Text == "" && txtPassword.Text == "" && txtComPassword.Text == "")
{
MessageBox.Show("Username and Password fields are empty", "Registration Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);

}
else if (txtPassword.Text == txtComPassword.Text)
{
con.Open();
string register = "INSERT INTO tbl_users VALUES ('" + txtUsername.Text + "','" + txtPassword.Text + "')";
cmd = new OleDbCommand(register, con);
cmd.ExecuteNonQuery();
con.Close();

txtUsername.Text = "";
txtPassword.Text = "";
txtComPassword.Text = "";

MessageBox.Show("Your Account has been Successfully Created", "Registration Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

}
else
{
MessageBox.Show("Passwords does not match, Please Re-enter", "Registration Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtPassword.Text = "";
txtComPassword.Text = "";
txtPassword.Focus();
}
}

private void checkbxShowPas_CheckedChanged(object sender, EventArgs e)
{
if (checkbxShowPas.Checked)
{
txtPassword.PasswordChar = '\0';
txtComPassword.PasswordChar = '\0';
}
else
{
txtPassword.PasswordChar = '•';
txtComPassword.PasswordChar = '•';
}
}

private void button2_Click(object sender, EventArgs e)
{
txtUsername.Text = "";
txtPassword.Text = "";
txtComPassword.Text = "";
txtUsername.Focus();
}

private void label6_Click(object sender, EventArgs e)
{
new frmLogin().Show();
this.Hide();
}

private void frmRegister_Load(object sender, EventArgs e)
{
//label2.Text = kryptonDateTimePicker1.Value.ToShortDateString();
}

private void label2_Click(object sender, EventArgs e)
{

}

}
}