title: textbox only allow ip address in textbox c#
body: <p>I'm trying to make a textbox only allow IP Addresses without validation using internet. I'm going to have a "private void textBox3_TextChanged" or a "timer1_Tick" which does the job. and each time I type or it ticks, it will check if it is a valid. That's why I want it to be fast, and only use a simple local code to check if it's valid, meaning 0.0.0.0 - 255.255.255.255.</p>
  
  <p>First, it should not do anything, but when an ip has been written, it will start a timer which then checks if the ip is reachable or not. The goal of this, is that when the IP has been written, a picturebox will turn red if ip is not reachable after about 4 secounds, and if it's reachable, it will turn green, then stop till "textbox3_TextChanged"</p>
  
  <p>I tried something like ping, but it crashed if nothing was typed and it lagged if ip was not reachable:</p>
  
  <pre><code>private void timer1_Tick(object sender, EventArgs e)
      {
          Ping pingSender = new Ping();
          PingOptions options = new PingOptions();
  
          options.DontFragment = false;
  
  
          // Create a buffer of 32 bytes of data to be transmitted.
          string data = "ping";
          byte[] buffer = Encoding.ASCII.GetBytes(data);
          int timeout = 120;
          PingReply reply = pingSender.Send(textBox3.Text, timeout, buffer, options);
          if (reply.Status == IPStatus.Success)
          {
              pictureBox4.BackColor = Color.LimeGreen;
          }
          else
              pictureBox4.BackColor = Color.Red;
      }
  </code></pre>
  
  <p>Here is a screenshot: <a href="http://imgur.com/Cvix2Tr" rel="nofollow">http://imgur.com/Cvix2Tr</a></p>
  
  <p>Please help :)</p>