locked
Repetitive Form Opening RRS feed

  • Question

  • private void btn_i_pembelian_Click(object sender, EventArgs e)

    { purchase_entry purchase_entry = null; if ((purchase_entry = (purchase_entry)IsFormAlreadyOpen(typeof(purchase_entry))) == null) { purchase_entry = new purchase_entry(); purchase_entry.Show(); } else { if (purchase_entry.WindowState == FormWindowState.Minimized) purchase_entry.WindowState = FormWindowState.Normal; purchase_entry.Focus(); } } private void btn_i_penjualan_Click(object sender, EventArgs e) { sale_entry sale_entry = null; if ((sale_entry = (sale_entry)IsFormAlreadyOpen(typeof(sale_entry))) == null) { sale_entry = new sale_entry(); sale_entry.Show(); } else { if (sale_entry.WindowState == FormWindowState.Minimized) sale_entry.WindowState = FormWindowState.Normal; sale_entry.Focus(); } }

    Can someone help me how to reduce this code..?
    i Think those code are repetitive..

    thanks for your attention.

    Sunday, April 8, 2012 1:31 PM

Answers