private void brandsListBox_DoubleClick(object sender, EventArgs e) { var locaBrandId = ((Brand)brandsBindingSource.Current).BrandId; using (var brandEditor = new BrandEditor(locaBrandId)) { brandEditor.ShowDialog(this); } }
private void newButton_Click(object sender, EventArgs e) { if (tabControl.SelectedTab.Name == "brands") { var brand = new Brand(); using (var brandEditor = new BrandEditor(brand)) { brandEditor.ShowDialog(this); } } else if (tabControl.SelectedTab.Name == "productTypes") { var productType = new ProductType(); using (var productTypeEditor = new ProductTypeEditor(productType)) { productTypeEditor.ShowDialog(this); BindProductType(); } } }