Título: StackOverFlow
Publicado por: m@o_614 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 // // Form3 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F ); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(388, 347); this.Controls.Add(this.cmdIr_Menu); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.cmdMostrar); this.Controls.Add(this.cmdAgregar); this.Controls.Add(this.txtServicios); this.Controls.Add(this.txtCategoria); this.Controls.Add(this.txtTipo); this.Controls.Add(this.txtTel); this.Controls.Add(this.txtUbicacion); this.Controls.Add(this.txtIdHotel); this.Controls.Add(this.txtNombre); this.Controls.Add(this.servicios); this.Controls.Add(this.categoria); this.Controls.Add(this.tipo); this.Controls.Add(this.txtTelefono); this.Controls.Add(this.ubicacion); this.Controls.Add(this.idHotel); this.Controls.Add(this.nombre); this.Controls.Add(this.alojamiento); this.Name = "Form3"; this.Text = "Form3"; ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.ResumeLayout(false);//Aqui esta el error this.PerformLayout(); }
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
Título: Re: StackOverFlow
Publicado por: 85 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
Título: Re: StackOverFlow
Publicado por: m@o_614 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 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 { public Form1() { Form1 menu = new Form1 (); } Form2 clientes = new Form2 (this);//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 (); private void cmdClientes_Click(object sender, EventArgs e) { this.Visible = false; clientes.Visible = true; } private void cmdAerolinea_Click(object sender, EventArgs e) { this.Visible = false; aerolinea.Visible = true; } private void cmdCuentas_Extras_Click(object sender, EventArgs e) { this.Visible = false; cuentasExtras.Visible = true; } private void cmdDetalle_Folio_Click(object sender, EventArgs e) { this.Visible = false; detalleFolio.Visible = true; } private void cmdDetalle_Venta_Avion_Click(object sender, EventArgs e) { this.Visible = false; detalleVentaAvion.Visible = true; } private void cmdDetalle_Venta_Hotel_Click(object sender, EventArgs e) { this.Visible = false; detalleVentaHotel.Visible = true; } private void cmdPresupuesto_Click(object sender, EventArgs e) { this.Visible = false; presupuesto.Visible = true; } private void cmdReservaciones_Aereas_Click(object sender, EventArgs e) { this.Visible = false; reservacionesAereas.Visible = true; } private void cmdReservaciones_Hotel_Click(object sender, EventArgs e) { this.Visible = false; reservacionesHotel.Visible = true; } private void cmdVenta_Boleto_Avion_Click(object sender, EventArgs e) { this.Visible = false; ventaBoletoAvion.Visible = true; } private void cmdVenta_Hotel_Click(object sender, EventArgs e) { this.Visible = false; ventaHotel.Visible = true; } private void alojamiento_Click(object sender, EventArgs e) { this.Visible = false; hospedaje.Visible = true; } private void cmdSalir_Click(object sender, EventArgs e) { Application.Exit(); } } }
y aqui esta la otra ventana 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 Form2 : Form { Form1 menu; public Form2(Form1 menu) { this.menu = menu; } private void irMenu_Click(object sender, EventArgs e) { this.Visible = false; menu.Visible = true; } } }
pero en la primer ventana me marca un error en el this que dice que no esta disponible en el contexto actual
Título: Re: StackOverFlow
Publicado por: 85 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. 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
|