I'm trying to make a label change text and color based on whether my application can detect an active internet connection.
private void lblConnection_Click(object sender, EventArgs e)
{
bool ConnCheck = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
if (ConnCheck == true)
{
lblConnection.Text = "Available";
lblConnection.ForeColor = Color.LimeGreen;
}
else
{
lblConnection.Text = "Unavailable";
lblConnection.ForeColor = Color.Red;
}//End Conncheck if statement//
}//End lblConnection Class//
I would also like to make the application watch this connection dynamically and update the label as things change.
Loading
VulpesPosted Aug 30, 2012, 11:07 AM
Tristen ShawPosted Aug 31, 2012, 10:43 AM
Works like a charm! :)
Tristen ShawPosted Aug 30, 2012, 9:47 AM