2
Answers

Exitin the program

Vladimir Ota

Vladimir Ota

16y
3.1k
1

I have a piece of code like the one below. It gets a string from somewhere, checks it and if string is empty it should display the message and exit the program. The problem is that it doesn't exit but continues. I can not figure out what I'm doing wrong.

public Form1()
{
    InitializeComponent();
   string str=getString();
   if (str=="")
   {
       MessageBox.Show("string is empty")
       Application.Exit();
    }
    .....
    .....
}

Answers (2)