private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 2 && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete " + this.dataGridView2.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Int32 n = e.RowIndex; MainMenu frm = new MainMenu(); String option = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); if (lblOption.Text.Contains("State")) { frm.delete_table_2params("tboptionproductsetup", "kategori", "state", "options", option); loadstate_grid(); } else if (lblOption.Text.Contains("Type")) { frm.delete_table_2params("tboptionproductsetup", "kategori", "tipe", "options", option); loadtipe_grid(); } else if (lblOption.Text.Contains("Trade Unit")) { frm.delete_table_2params("tboptionproductsetup", "kategori", "tradeunit", "options", option); loadtradeunit_grid(); } } } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == 3 && e.RowIndex >= 0 && dataGridView1.Rows.Count > 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete Box " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Int32 n = e.RowIndex; Int32 id = 0; String intlotcode = txtintlotcode.Text.Trim(); String boxno = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); MainMenu frm = new MainMenu(); try { txtnumberbox.Text = boxno; frm.delete_table_2params("tbreceiving_loinbox", "intlotcode", intlotcode, "boxno", boxno); } catch (Exception ex) { MessageBox.Show("Error message " + ex.Message); } display_data(); } } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == dataGridView1.Columns["Delete"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String vessel = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); MainMenu frm = new MainMenu(); frm.delete_table_2params("tbvessel", "vesselname", vessel, "suppcode", this.suppcode.Text); dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index); loaddatavessel(); } } if (e.ColumnIndex == dataGridView1.Columns["Edit"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to Edit " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { flagedit = 1; MainMenu frm = new MainMenu(); String vessel = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_2param("tbvessel", "vesselname", vessel, "suppcode", this.suppcode.Text); if (data.Count > 0) { txtvesselname.Text = vessel; vesselglobal = txtvesselname.Text; txtvesselsize.Text = data[0][3].ToString(); txtflag.Text = data[0][5].ToString(); txtvesselregno.Text = data[0][4].ToString(); dateTimePicker1.Value = DateTime.Parse(data[0][6].ToString()); cbFishingGear.Text = data[0][7].ToString(); cbfishing_ground.Text = data[0][9].ToString(); if (data[0][8].ToString().Equals("Y")) { rbYes.Checked = true; } else { rbNo.Checked = true; } } } } }
private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGridView2.Columns["Delete"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete Certificate " + this.dataGridView2.Rows[e.RowIndex].Cells[0].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String tipe = this.dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString(); MainMenu frm = new MainMenu(); frm.delete_table_2params("tbsetup", "category", "certificate", "optionremark", tipe); dataGridView2.Rows.RemoveAt(dataGridView2.SelectedRows[0].Index); } } }