elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a Git (Primera Parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  StackOverFlow
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: StackOverFlow  (Leído 1,925 veces)
m@o_614


Desconectado Desconectado

Mensajes: 389


Ver Perfil
StackOverFlow
« en: 20 Abril 2013, 03:11 am »

Saludos

Estoy haciendo una base de datos que tiene un menu y unas 12 entidades, y les estoy haciendo su interfaz gráfica en c#, estas ventanas tienen que estar enlazadas y la primera vez que lo compile me salió bien los botones del menú me llevaban a la ventana correspodiente y tal. Pero ahora no me compila me aparece un error que dice

No se controló StackOverFlowException

No se puede evaluar la expresión porque el subproceso actual está en un estado de desbordamiento de pila

y me aparece este código también pero no tengo idea de qué significa

Código
  1. //
  2.            // Form3
  3.            //
  4.            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  5.            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  6.            this.ClientSize = new System.Drawing.Size(388, 347);
  7.            this.Controls.Add(this.cmdIr_Menu);
  8.            this.Controls.Add(this.dataGridView1);
  9.            this.Controls.Add(this.cmdMostrar);
  10.            this.Controls.Add(this.cmdAgregar);
  11.            this.Controls.Add(this.txtServicios);
  12.            this.Controls.Add(this.txtCategoria);
  13.            this.Controls.Add(this.txtTipo);
  14.            this.Controls.Add(this.txtTel);
  15.            this.Controls.Add(this.txtUbicacion);
  16.            this.Controls.Add(this.txtIdHotel);
  17.            this.Controls.Add(this.txtNombre);
  18.            this.Controls.Add(this.servicios);
  19.            this.Controls.Add(this.categoria);
  20.            this.Controls.Add(this.tipo);
  21.            this.Controls.Add(this.txtTelefono);
  22.            this.Controls.Add(this.ubicacion);
  23.            this.Controls.Add(this.idHotel);
  24.            this.Controls.Add(this.nombre);
  25.            this.Controls.Add(this.alojamiento);
  26.            this.Name = "Form3";
  27.            this.Text = "Form3";
  28.            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  29.            this.ResumeLayout(false);//Aqui esta el error
  30.            this.PerformLayout();
  31.  
  32.        }

 el error supuestamente esta en las ultimas lineas, la verdad estoy medio desesperada porque segun yo no habia nada mal

si alguien me pudiera ayudar le agradeceria mucho


« Última modificación: 20 Abril 2013, 03:16 am por m@o_614 » En línea

85

Desconectado Desconectado

Mensajes: 206



Ver Perfil WWW
Re: StackOverFlow
« Respuesta #1 en: 20 Abril 2013, 21:49 pm »

hace rato que no uso C# pero según recuerdo el compilador era bastante inteligente para identificar las fallas.
Los errores o advertencias del compilador los podés investigar en tu buscador, por ejemplo en google
http://stackoverflow.com/questions/206820/how-do-i-prevent-and-or-handle-a-stackoverflowexception
http://solocodigo.com/27152/no-se-controlo-system-stackoverflowexception/
puede haber gente que haya tenido el mismo problema
salu2


En línea

Me cerraron el Windows Live Spaces, entonces me creé un WordPress XD
http://etkboyscout.wordpress.com/
m@o_614


Desconectado Desconectado

Mensajes: 389


Ver Perfil
Re: StackOverFlow
« Respuesta #2 en: 21 Abril 2013, 04:05 am »

Saludos

ahora ya tengo un poco más claro de por qué me aparecía el error de StackOverFlow, era la manera en la que estaba instanciando las cosas


Esta es el código de la ventana menú que va a estar enlazada con varios botones que a su vez van a tener un boton para regresar al menú

Algo así como un ir y venir

Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace Agencia_de_Viajes
  11. {
  12.    public partial class Form1 : Form
  13.    {
  14.        public Form1()
  15.        {
  16.            Form1 menu = new Form1();
  17.        }
  18.  
  19.        Form2 clientes = new Form2(this);//Aquí me marca error
  20.        Form3 aerolinea = new Form3();
  21.        Form4 hospedaje = new Form4();
  22.        Form5 cuentasExtras = new Form5();
  23.        Form6 detalleFolio = new Form6();
  24.        Form7 detalleVentaAvion = new Form7();
  25.        Form8 detalleVentaHotel = new Form8();
  26.        Form9 presupuesto = new Form9();
  27.        Form10 reservacionesAereas = new Form10();
  28.        Form11 reservacionesHotel = new Form11();
  29.        Form12 ventaBoletoAvion = new Form12();
  30.        Form13 ventaHotel = new Form13();
  31.  
  32.        private void cmdClientes_Click(object sender, EventArgs e)
  33.        {
  34.            this.Visible = false;
  35.            clientes.Visible = true;
  36.        }
  37.  
  38.        private void cmdAerolinea_Click(object sender, EventArgs e)
  39.        {
  40.            this.Visible = false;
  41.            aerolinea.Visible = true;
  42.        }
  43.  
  44.        private void cmdCuentas_Extras_Click(object sender, EventArgs e)
  45.        {
  46.            this.Visible = false;
  47.            cuentasExtras.Visible = true;
  48.        }
  49.  
  50.        private void cmdDetalle_Folio_Click(object sender, EventArgs e)
  51.        {
  52.            this.Visible = false;
  53.            detalleFolio.Visible = true;
  54.        }
  55.  
  56.        private void cmdDetalle_Venta_Avion_Click(object sender, EventArgs e)
  57.        {
  58.            this.Visible = false;
  59.            detalleVentaAvion.Visible = true;
  60.        }
  61.  
  62.        private void cmdDetalle_Venta_Hotel_Click(object sender, EventArgs e)
  63.        {
  64.            this.Visible = false;
  65.            detalleVentaHotel.Visible = true;
  66.        }
  67.  
  68.        private void cmdPresupuesto_Click(object sender, EventArgs e)
  69.        {
  70.            this.Visible = false;
  71.            presupuesto.Visible = true;
  72.        }
  73.  
  74.        private void cmdReservaciones_Aereas_Click(object sender, EventArgs e)
  75.        {
  76.            this.Visible = false;
  77.            reservacionesAereas.Visible = true;
  78.        }
  79.  
  80.        private void cmdReservaciones_Hotel_Click(object sender, EventArgs e)
  81.        {
  82.            this.Visible = false;
  83.            reservacionesHotel.Visible = true;
  84.        }
  85.  
  86.        private void cmdVenta_Boleto_Avion_Click(object sender, EventArgs e)
  87.        {
  88.            this.Visible = false;
  89.            ventaBoletoAvion.Visible = true;
  90.        }
  91.  
  92.        private void cmdVenta_Hotel_Click(object sender, EventArgs e)
  93.        {
  94.            this.Visible = false;
  95.            ventaHotel.Visible = true;
  96.        }
  97.  
  98.        private void alojamiento_Click(object sender, EventArgs e)
  99.        {
  100.            this.Visible = false;
  101.            hospedaje.Visible = true;
  102.        }
  103.  
  104.        private void cmdSalir_Click(object sender, EventArgs e)
  105.        {
  106.            Application.Exit();
  107.        }
  108.    }
  109. }
  110.  


y aqui esta la otra ventana

Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace Agencia_de_Viajes
  11. {
  12.    public partial class Form2 : Form
  13.    {
  14.        Form1 menu;
  15.        public Form2(Form1 menu)
  16.        {
  17.            this.menu = menu;
  18.        }
  19.  
  20.        private void irMenu_Click(object sender, EventArgs e)
  21.        {
  22.            this.Visible = false;
  23.            menu.Visible = true;
  24.        }
  25.    }
  26. }
  27.  
pero en la primer ventana me marca un error en el this que dice que no esta disponible en el contexto actual
En línea

85

Desconectado Desconectado

Mensajes: 206



Ver Perfil WWW
Re: StackOverFlow
« Respuesta #3 en: 21 Abril 2013, 05:37 am »

Si esto no te funciona te puedo mostrar mi proyecto que hice hace un año, en el cual también tube que usar cierta manipulación del puntero THIS para poderlo transportar entre distintos ámbitos del proyecto.
http://foro.elhacker.net/net/steamrcp_gui_parecida_al_steam_y_conexion_con_bdd-t386291.0.html
te puede interesar.. yo realmente no programo más en C# XD , pero si puedo aportar algo lo hago.
Código:
using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.Data;
        using System.Drawing;
        using System.Linq;
        using System.Text;
        using System.Windows.Forms;
 
        namespace Agencia_de_Viajes
        {
            public partial class Form1 : Form
            {

                static Form1 testaferro=null;
                public Form1()
                {
                    testaferro=this;
                    Form1 menu = new Form1();
                }
 
                Form2 clientes = new Form2(testaferro);//Aquí me marca error
                Form3 aerolinea = new Form3();
                Form4 hospedaje = new Form4();
                Form5 cuentasExtras = new Form5();
                Form6 detalleFolio = new Form6();
                Form7 detalleVentaAvion = new Form7();
                Form8 detalleVentaHotel = new Form8();
                Form9 presupuesto = new Form9();
                Form10 reservacionesAereas = new Form10();
                Form11 reservacionesHotel = new Form11();
                Form12 ventaBoletoAvion = new Form12();
                Form13 ventaHotel = new Form13();


salu2
En línea

Me cerraron el Windows Live Spaces, entonces me creé un WordPress XD
http://etkboyscout.wordpress.com/
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines