帮助验证IP地址 [英] Help in validating an IP address

查看:101
本文介绍了帮助验证IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public class IPAddressTextBox : RegExTextBox
        {
            public IPAddressTextBox()
            {
                InitializeComponent();
                this.ValidationExpression = @"^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$";
                this.ErrorMessage = "The IP address must be in the form of 111.111.111.111";
            }
        }





我已使用此代码在我的项目中验证IP地址,并且出现了错误

找不到类型或名称空间名称"RegExTextBox"(正在​​使用指令还是程序集引用)

我不知道此C#的用法..

[edit]未选中忽略文本中的HTML"选项以使代码块"起作用-将来尝试使用预览来检查格式![/edit]





I have used this code for validating an IPaddress in my project and i have got an error as

"The type or namespace name "RegExTextBox" could not be found( are you using directive or an assembly reference)

i am not aware of this C# how to use..

[edit]Unchecked "Ignore HTML in text" option to let the "Code Block" work - in future try using the preview to check the formatting![/edit]

推荐答案

"; .ErrorMessage= " ; } }
"; this.ErrorMessage = "The IP address must be in the form of 111.111.111.111"; } }





我已使用此代码在我的项目中验证IP地址,并且出现了错误

找不到类型或名称空间名称"RegExTextBox"(正在​​使用指令还是程序集引用)

我不知道此C#的用法..

[edit]未选中忽略文本中的HTML"选项以使代码块"起作用-以后尝试使用预览来检查格式![/edit]





I have used this code for validating an IPaddress in my project and i have got an error as

"The type or namespace name "RegExTextBox" could not be found( are you using directive or an assembly reference)

i am not aware of this C# how to use..

[edit]Unchecked "Ignore HTML in text" option to let the "Code Block" work - in future try using the preview to check the formatting![/edit]


您的意思是 RegexTextBox:Windows控件库 [
Do you mean RegexTextBox: A Windows Control Library[^]? If so, then I assume you have downloaded teh source code, but not included it in your project.

Either add the relevant files to your project, and change the namespace to match, or add the files as a new project, to build a dll, and include a reference / using in your existing project.


这篇关于帮助验证IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆