I have a method that requires internet connection to function, How can I check for internet connection before my form loads? I would like to display an error message box if there is no connection and NOT load to form.
Here's my attempt:
private void Form1_Load(object sender, EventArgs e)
{
bool checkConnection = NetworkInterface.GetIsNetworkAvailable();
if (checkConnection = false)
{
MessageBox.Show("error no con.");
}