public FrmArim() { InitializeComponent(); ir = new ir(); dgvarim.DataSource = arim.GetDataTable(); SetHeaderColumn(); }
private void dgvarim_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { groupBox1.Visible = true; btnOsef.Visible = false; btnAdcen.Visible = true; ir = new ir(Convert.ToInt32(dgvarim.SelectedRows[0].Cells[0].Value)); lblKod.Text = ir.KodIr.ToString(); txtShem.Text = ir.ShemIr; }
private void btnMachak_Click(object sender, EventArgs e) { ir ir = new ir(Convert.ToInt32(dgvarim.SelectedRows[0].Cells[0].Value)); DataView dv = new DataView(new asakimTable().GetDataTable()); dv.RowFilter = "kodIr=" + ir.KodIr; if (dv.Count > 0) { MessageBox.Show("לא ניתן למחוק כיוון שיש רשומות מקושרות"); } ir.Delete(); }