//OK private void okToolStripMenuItem_Click(object sender, EventArgs e) { try { double Price = 0; int Count = 0; Int32.TryParse(dgv.Rows[0].Cells[3].Value.ToString(), out Count); Double.TryParse(dgv.Rows[0].Cells[4].Value.ToString(), out Price); Shop.AddGoods(g.ID, Count, Price); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); } }