private void btn_edit_Click(object sender, EventArgs e) { frm_Add edit = new frm_Add(); id = Convert.ToInt32(gridView1.GetFocusedRowCellValue("Id")); Buyer edited = db.Buyers.Where(x => x.Id == id).FirstOrDefault(); edit.txtid.Text = edited.Id.ToString(); edit.txtitemName.Text = edited.name; edit.txtSuppliersName.Text = edited.SuppliersName; edit.dateTimePicker1.Value = DateTime.Parse(edited.BuyingDate.ToString()); edit.txtSell.Text = Convert.ToDouble(edited.SellingPrice).ToString(); edit.numericUpDown1.Value = int.Parse(edited.itemsNumbers.ToString()); edit.txtBuy.Text = Convert.ToDouble(edited.BuyingPrice).ToString(); edit.txtTotalPrice.Text = Convert.ToDouble(edited.Profit).ToString(); edit.BtnAdd.Text = "تعديل"; edit.Show(); this.Close(); }
private void btnbuy_Click(object sender, EventArgs e) { frm_Add frm_addbuyer = new frm_Add(); frm_addbuyer.ShowDialog(); }