Hello,
I have made a form where the user can enter the ip address and save it in a notepad the same values are retrieved again.Now I want to see whether the ip address are correct and need to pass it in a method
Plzz need your advice !
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Francis SusaimichaelRank #466 · 5.4K reputationPosted Dec 18, 2015, 10:00 PM EST
Raghav Jhavar57 reputationPosted Dec 18, 2015, 10:27 PM EST
Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 18, 2015, 10:32 PM EST
foreach (var ipLine in File.ReadAllLines("proxy.txt")) { var ip = IPAddress.Parse(ipLine); if (ip.AddressFamily.ToString() == "InterNetwork") { localIP = ip.ToString(); textBox1.Text = ip.ToString(); } } Reference : http://stackoverflow.com/questions/12037772/how-to-convert-string-to-system-net-ipaddressRohit Nair142 reputationPosted Dec 18, 2015, 11:32 PM EST
Francis SusaimichaelRank #466 · 5.4K reputationPosted Dec 19, 2015, 1:54 AM EST
// Will return the searched IP from the array
string[] arr=Array.FindAll(ipAddresArray, element => element.Contains("192.176.3.3"));
// check the length to find how many times it occurs
if(arr.Length > 1)
{
// do your action
}