public FrmProduct(Product product, ChildMainProducts father)
 {
     InitializeComponent();
     _product = product;
     _edit    = true;
     _father  = father;
 }
Example #2
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            var childProducts = new ChildMainProducts();

            if (pnlDashboard.Controls.Count > 0)                                     //Si el panel principal contiene un Formulario hijo
            {
                if (pnlDashboard.Controls[0].GetType() != typeof(ChildMainProducts)) //Si el tipo de formulario es diferente a ChildMenuProducts
                {
                    OpenChildForm(childProducts);                                    //Agrega un nuevo formulario de childMenuProducts
                }
                else
                {
                    childProducts = (ChildMainProducts)pnlDashboard.Controls[0];
                }
            }
            else
            {
                OpenChildForm(childProducts);
            }
            var form = new FrmProduct(childProducts);

            form.Show();
        }
 public FrmProduct(ChildMainProducts father)
 {
     InitializeComponent();
     _edit   = false;
     _father = father;
 }