private void textCode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Clockin.PerformClick(); } }
private void textSurname_KeyDown(object sender, KeyEventArgs e) { DialogResult dl = MessageBox.Show("Can't enter with manual", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); string sql = "SELECT * FROM EMPLOYEE WHERE EMP_CODE = '" + textCode.Text + "'"; MySqlConnection con = new MySqlConnection("host = angsila.informatics.buu.ac.th; user = cs57160477; password = cs57160477; database = cs57160477"); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { textSurname.Text = reader.GetString("EMP_LNAME"); } con.Close(); if (e.KeyCode == Keys.Enter) { Clockin.PerformClick(); } }