private void comCCode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (comCCode.Text == "") { MessageBox.Show("Please Enter the Data!", "Invalied Data!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { con.Open(); OleDbCommand cmd1 = new OleDbCommand("select * from customer where CustomerCode=" + comCCode.Text.Trim() + " ", con); cmd1.Connection = con; rdr = cmd1.ExecuteReader(); bool temp = false; while (rdr.Read()) { comCName.Text = rdr["CustomerName"].ToString(); temp = true; } CmdSave.Focus(); if (temp == false) { MessageBox.Show("Record Not Found!", "MESSAGE BOX", MessageBoxButtons.OK, MessageBoxIcon.Error); comCCode.Text = ""; comCName.Text = ""; comCCode.Focus(); } con.Close(); } } }
private void txtCrName_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtCrName.Text == "") { MessageBox.Show("Please Enter the Data!", "Invalied Data!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { CmdSave.Focus(); } } }
private void txtPHint_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtPHint.Text == "") { MessageBox.Show("Please Enter the Word or Remember this Password!", "Invalied Data!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { CmdSave.Focus(); } } }
private void txtRate_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtRate.Text == "") { MessageBox.Show("Please Enter the Data!", "Invalied Data!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { double aa = 0.00; aa = Convert.ToDouble(txtRate.Text.ToString()); txtRate.Text = aa.ToString("#,###.00"); CmdSave.Focus(); } } }