private void button1_Click(object sender, EventArgs e) { var supplier = new SupplierForm(); supplier.OnSave += Supplier_OnSave; supplier.ShowDialog(); }
private void button2_Click(object sender, EventArgs e) { using (var supp = new SupplierForm()) { supp.OnSave += Supp_OnSave; supp.ShowDialog(); } }
private void comboBox1_Validated(object sender, EventArgs e) { if (supplierOption.Text == string.Empty) { return; } using (var p = new POSEntities()) { if (p.Suppliers.FirstOrDefault(x => x.Name == supplierOption.Text) == null) { MessageBox.Show("Supplier not found."); using (var supplier = new SupplierForm()) { supplier.OnSave += Supplier_OnSave; supplier.ShowDialog(); } this.ActiveControl = supplierOption; } } }