private void ButtonClickHandler(object sender, EventArgs e) { var button = (Button)sender; var productIndex = int.Parse(button.Name.Substring(3)) - 1; ProductSelected?.Invoke(this, new ProductSelectedEventArgs(_products[productIndex])); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string productName = (string)this.comboBox1.SelectedItem; ProductSelectedEventArgs eventArgs = new ProductSelectedEventArgs { ProductName = productName }; ProductSelected?.Invoke(sender, eventArgs); }
private void DgvProducts_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5) { ProductSelected?.Invoke(this, int.Parse(dgvProducts[0, e.RowIndex].Value.ToString())); PopulateInputControlsFromGrid(e.RowIndex); } else if (e.ColumnIndex == 6) { DeleteProduct?.Invoke(this, int.Parse(dgvProducts[0, e.RowIndex].Value.ToString())); } }