C#验证IP地址

it2026-03-29  10

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地址
最新回复(0)