private void btnSelect_Click(object sender, EventArgs e) { if (dgvProducts.SelectedRows.Count > 0) { this.Product = lstProducts.Products.FirstOrDefault(c => c.ID == Guid.Parse(dgvProducts.SelectedRows[0].Cells[0].Value.ToString())); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("Select a Product"); } }
private void btnNewProduct_Click(object sender, EventArgs e) { Product product = new Product(); product.Name = txtProductName.Text; }
private void btnSelectProduct_Click(object sender, EventArgs e) { SelectProduct productForm = new SelectProduct(); productForm.lstProducts = lstProduct; if (productForm.ShowDialog() == DialogResult.OK) { this.product = productForm.Product; txtProduct.Text = this.product.Name; } }