private bool TryIp(string ipaddress) { string[] ip = new string[4]; string s = "."; ip = ipaddress.Split(s.ToCharArray(), 4); if (ip.Length < 4) { return false; } for (int i = 0; i < 4; i++) { if (Convert.ToInt32(ip[i]) >= 255) { return false; } } return true; }