0

Tengo un formulario llamado SearchCustomer y dos formularios padres (SharePoints and ViewCustomer), a la hora de abrir el formulario SearchCustomer en ViewCustomer si lo levanta y muestra datos, pero, a la hora de abrirlo en SharePoints ya no funciona, ya que crea un formulario "en blanco", ¿Alguna solución? , adjunto mi código:

Formulario SearchCustomer:

frmViewCustomer frmp;
        frmPuntoDeVenta frmPuntoDeVenta;
        public object frmglobal;
        public frmViewCustomer frmViewCustomer;

        public frmSearchCustomer(frmViewCustomer frmglobal)
        {
            InitializeComponent();
            frmp = frmglobal;
            
        }

        public frmSearchCustomer(frmPuntoDeVenta frmPuntoDeVenta)
        {
            this.frmPuntoDeVenta = frmPuntoDeVenta;
        }

        public frmSearchCustomer(object frmglobal, frmViewCustomer frmViewCustomer)
        {
            this.frmglobal = frmglobal;
            this.frmViewCustomer = frmViewCustomer;
        }

Formulario ViewCustomer:

if (e.KeyCode == Keys.F1)
            {
                frmSearchCustomer frmd = new frmSearchCustomer(this);
                frmd.Show();
            }

Formulario SharePoints:

if (e.KeyCode == Keys.F1)
            {
                frmSearchCustomer frmd = new frmSearchCustomer(this);
                frmd.Show();
            }

Pero no devuelve el formulario en SharePoints, sólo en ViewCustomer

1 respuesta 1

0

Investigando y debuggeando el código, logré encontrar el error, el error fue que no se estaba enviando correctamente el objeto global llamado frmglobal del formulario SearchCustomer a los formularios padres (SharePoints y ViewCustomer)

Variables y funciones correctas en SearchCustomer

frmViewCustomer frmp;
        frmPuntoDeVenta frmPuntoDeVenta;
        public object frmglobal;
        public frmViewCustomer frmViewCustomer;

        public frmSearchCustomer()
        {
            InitializeComponent();
            
        }

        public frmSearchCustomer(object frmglobal, frmPuntoDeVenta frmPuntoDeVenta)
        {
            this.frmglobal = frmglobal;
            this.frmPuntoDeVenta = frmPuntoDeVenta;
        }

        public frmSearchCustomer(object frmglobal, frmViewCustomer frmViewCustomer)
        {
            this.frmglobal = frmglobal;
            this.frmViewCustomer = frmViewCustomer;
        }

Código de apertura de formulario en los padres:

if (e.KeyCode == Keys.F1)
            {
                frmSearchCustomer frmd = new frmSearchCustomer();
                frmd.Show();
            }

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.