private void btnApplyPForD_Click(object sender, EventArgs e) { try { if (GVTableShowPforD.RowCount > 0) { var db = new linqDataContext(); var gvObj = new MainFrm(); db.SelectPartsforDevice(db.GivePartIdTakePartName(GVTableShowPforD.CurrentRow.Cells[0].Value.ToString()), Convert.ToInt32(orderIdValue), PersianDate.GetPersianDate()); this.Close(); } } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }