Hello - Thanks in advance for your help. Working on re-learning MS VS2012.
OS Win 8.1.1, VS2012 Premium. .Net Framework v 4.5.51641. Visual C#
Trying to use -> IsOffLine to see if computer is connected to network.
From what I read online, ConnectivityStatus is in System.Web.ClientServices.
URL:
http://social.msdn.microsoft.com/Search/en-US?query=connectivitystatus&emptyWatermark=true&ac=2[
^]
However, I am getting the following error.
Error 1 The name 'ConnectivityStatus' does not exist in the current context c:\users\bob\documents\visual studio 2012\Projects\IsOffLine\IsOffLine\Program.cs 15 17 IsOffLine
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.ClientServices;
namespace IsOffLine
{
class Program
{
static void Main(string[] args)
{
if (ConnectivityStatus.IsOffline)
{
Console.WriteLine("ConnectivityStatus is Off Line.");
Console.ReadLine();
}
else
{
Console.WriteLine("ConnectivityStatus is On Line.");
Console.ReadLine();
}
}
}
}