title: how to get an event whenever the network cable is connected or disconnected
body: <p>im doing an application in which im transfering file through FTP.i succesfully done all
  the things to transfer files and folders.now i want to know how to get an event whenever the
  the network cable is connected or disconnected while im transfering a file.</p>
  
  <p>im using SYSTEM.NET NAMESPACE,FTPWEBREQUEST Class.</p>
  
  <p>when will the event get raised i just run mi program and disconnected the network cable
  but nothing happens.</p>
  
  <p>im not able to raise the event will u send ur code .actually it is working in vb.net.it doesnt get raised in c# below is mycode:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public static event NetworkAvailabilityChangedEventHandler networkchanged;
      string file_to_upload;
      string serverip;
      string username;
      string password;
      FileStream fstream;
      Stream strem;
  
      public Form1()
      {
          InitializeComponent();
          networkchanged += new NetworkAvailabilityChangedEventHandler(Form1_networkchanged);
  
  
      }
  
      void Form1_networkchanged(object sender, NetworkAvailabilityEventArgs e)
      {
          //my implementations goes here
          //throw new Exception("The method or operation is not implemented.");
      }
  </code></pre>
  
  <p>i done it this is very useful.thank you very much</p>