private void CreateProductButton_Click(object sender, EventArgs e) { try { SqlProductRepository products = new SqlProductRepository(connectionString); Product createProduct = products.CreateProduct(SKUTextbox.Text, NameTextbox.Text, Convert.ToInt32(TypeIdTextbox.Text), Convert.ToInt32(QuantityTextbox.Text), DescriptionTextBox.Text, PriceTextBox.Text, RatingTextbox.Text); list.Add(createProduct); ProductsData pd = new ProductsData(); pd.dataGridView1.DataSource = list; } catch (Exception ex) { MessageBox.Show("There cannot be any empty or incorrectly entered parameters. Check submission."); } }