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(); } ..... .....}