private void btnApply_Click_1(object sender, EventArgs e) { try { //if (txtPartAlert.Text == "" || txtPartName.Text == "" || txtPartPrice.Text == "") // MessageBox.Show("لطفا موارد خواسته شده را پر نمایید"); //else //{ var db = new linqDataContext(); //stored//int.Parse(txtPartId.Text), db.ApplyPart(txtPartName.Text.ToString(), Convert.ToInt32(txtPartPrice.Text), Convert.ToInt32(txtPartAlert.Text)); var gvobj = new MainFrm(); gvobj.GVTablePart.DataSource = db.ShowParts(); this.Close(); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } //} }