Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
Quiero cerrar mi consola usando un método de cierre. No a través de la X

Tengo un pequeño problema. Quiero cerrar mi consola usando un método de cierre. No a través de la X.

Para esto tengo un caso "9" en el bloque de interruptores;

Esto significa que cuando ingreso "9" y presiono enter, la ventana debería cerrarse. Los intentos anteriores de llamar a Application.Close(); con un método no funcionó.

¿Alguien tiene una solución, o esto ni siquiera es posible desde el interruptor?

 private void InputOption() { string input; Menu nextMenu; while(true) //Die Eingabe muss die zahlen beinhalten. { Console.Write("Eingabe: "); input = Console.ReadLine(); bool correctInput = true; switch(input) { case "1": nextMenu = new CreateProfileMenu(); break; case "2": nextMenu = new LoadProfileMenu(); break; case "9": Close(); break; default: correctInput = false; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Ungültige Eingabe!"); Console.ForegroundColor = ConsoleColor.DarkCyan; break; } if (correctInput) { break; } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

He encontrado el problema. La Asamblea

 I have found the error. There was a missing link to System.Windows.Forms;

Ahora he implementado con éxito el método Close() en Switch Block.

 case "9" : Close(); ... private void Close() { Application.Exit(); }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!