public void Connection_Authentication() { while (true) { bool Auth = ConnectionChecker.InternetConnectionChecker(); if (Auth == false) { DialogResult Dr = MessageBox.Show("You are not Connected to the internet", "No Connection", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (Dr == DialogResult.Retry) { if (Auth == true) { break; } else { continue; } } else { Application.Exit(); break; } } else { break; } } }