using System.Net;
try
{
IPAddress a =
IPAddress.Parse(输入的IP字符串);
}
catch (System.Exception ex)
{
MessageBox.Show("输入错误:输入的IP地址无效,请重新输入。",
"错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
转载于:https://www.cnblogs.com/xxxteam/p/3316537.html
相关资源:C#使用正则表达式验证IP地址
转载请注明原文地址: https://win8.8miu.com/read-1557139.html