private void InitControls() { TxtDivision.Text = TxtNames.Text = string.Empty; TxtDivision.Focus(); mymode = BaseMode.NONE; }
private void InitControls() { TxtDivision.Text = TxtNames.Text = ""; TxtDivision.Focus(); myMode = BaseMode.NONE; }
private void ClearTextControls() { TxtDivision.Text = TxtNames.Text = ""; TxtDivision.ReadOnly = false; TxtDivision.BackColor = Color.White; TxtDivision.Focus(); }
//private void DeleteProcess() //{ // try // { // using (MySqlConnection conn = new MySqlConnection(Commons.CONNSTR)) // { // conn.Open(); // MySqlCommand cmd = new MySqlCommand(); // cmd.Connection = conn; // cmd.CommandText = "DELETE FROM divtbl " + // "WHERE Division = @Division "; // MySqlParameter paramDivision = new MySqlParameter("@Division", MySqlDbType.VarChar); // paramDivision.Value = TxtDivision.Text; // cmd.Parameters.Add(paramDivision); // var result = cmd.ExecuteNonQuery(); // MetroMessageBox.Show(this, $"{result}건이 삭제되었습니다.", "삭제"); // } // } // catch (Exception ex) // { // MetroMessageBox.Show(this, $"에러발생 {ex.Message}", "에러", MessageBoxButtons.OK, MessageBoxIcon.Error); // } // finally // { // UpdateDate(); // } //} #endregion private void BtnNew_Click(object sender, EventArgs e) { TxtDivision.Text = TxtNames.Text = string.Empty; TxtDivision.ReadOnly = false; TxtDivision.Focus(); myMode = BaseMode.INSERT; // 신규 입력 모드 }
/* * private void DeleteProcess() * { * try * { * using (MySqlConnection conn = new MySqlConnection(Commons.CONNSTR)) * { * conn.Open();//커넥션오픈,using쓰면 자동으로 conn.close();해줌 * MySqlCommand cmd = new MySqlCommand(); * cmd.Connection = conn; * cmd.CommandText = "DELETE FROM divtbl " + * " WHERE Division = @Division "; * * MySqlParameter paramDivision = new MySqlParameter("@Division", MySqlDbType.VarChar); * paramDivision.Value = TxtDivision.Text; * cmd.Parameters.Add(paramDivision); * * var result = cmd.ExecuteNonQuery(); * * MetroMessageBox.Show(this, $"{result}건이 삭제되었습니다.", "삭제"); * } * } * catch (Exception ex) * { * MetroMessageBox.Show(this, $"에러발생{ex.Message}", "에러", MessageBoxButtons.OK, MessageBoxIcon.Error); * throw; * } * finally * { * * } * } */ #endregion private void BtnNew_Click(object sender, EventArgs e) { TxtDivision.Text = TxtNames.Text = string.Empty; //모두 빈칸 TxtDivision.ReadOnly = false; //리드온리 켜뒀던걸 꺼주기, 데이터 입력해야하기때문 mymode = BaseMode.INSERT; //신규입력모드 TxtDivision.Focus(); }
/* * private void DeleteProcess() * { * * try * { * using (MySqlConnection conn = new MySqlConnection(Commons.CONNSTR)) * { * conn.Open(); * MySqlCommand cmd = new MySqlCommand(); * cmd.Connection = conn; * cmd.CommandText = "DELETE FROM divtbl " + * " WHERE Division = @Division "; * * MySqlParameter paramDeivison = new MySqlParameter("@Division", MySqlDbType.VarChar); * cmd.Parameters.Add(paramDeivison); * * var result = cmd.ExecuteNonQuery(); * * MetroMessageBox.Show(this, $"{result}건이 삭제되었습니다.", "삭제"); * } * } * catch (Exception ex) * { * MetroMessageBox.Show(this, $"에러발생 : {ex.Message}", "에러", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * finally * { * UpdateData(); * } * } */ #endregion private void btnNew_Click(object sender, EventArgs e) { TxtDivision.Text = TxtNames.Text = string.Empty; // 새로운 삽입하기 위해 ReadOnly를 false 상태로 만든다. TxtDivision.ReadOnly = false; myMode = BaseMode.INSERT; TxtDivision.Focus(); }
private void InitControls() { TxtDivision.Clear(); TxtDivision.ReadOnly = true; TxtNames.Clear(); TxtDivision.Focus(); baseMode = BaseMode.NONE; }
private void GrdDivtbl_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { DataGridViewRow data = GrdDivtbl.Rows[e.RowIndex]; TxtDivision.Text = data.Cells[0].Value.ToString(); TxtNames.Text = data.Cells[1].Value.ToString(); TxtDivision.ReadOnly = true; //pk는 바꾸면 난리나니까 바꾸지 못하게 설정 TxtDivision.Focus(); myMode = BaseMode.UPDATE; // 수정 모드 변경 } }
private void ClearTextControl() { TxtDivision.Text = TxtNames.Text = ""; TxtDivision.ReadOnly = false; TxtDivision.Focus(); }
private void InitControls() { TxtDivision.Text = TxtNames.Text = string.Empty; TxtDivision.Focus(); }
private void ClearTextControls() { TxtDivision.Text = TxtNames.Text = string.Empty; TxtDivision.ReadOnly = false; TxtDivision.Focus(); }