C#Windows窗体应用程序中的客户端窗体验证 [英] client side form validation in C# windows form application

查看:99
本文介绍了C#Windows窗体应用程序中的客户端窗体验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用C#(Visual Studio)创建了一个用于输入的表单,

用户名
密码
年龄
性别
地址
电子邮件.

我想检查此字段的有效性,例如:

用户名(只能是字符)
密码(必须为8个字符长)
年龄(必须为整数)
电子邮件(验证)

怎么做?

在Web应用程序中,我们可以通过javascript执行此类任务,如何在Windows窗体应用程序中执行客户端窗体验证?

I''ve created a form using C# (visual studio) for entering,

username
password
age
sex
address
email.

I want to check the validity of this field like:

username (must be only characters)
password (must be 8 characters long)
age (must be in integers)
email (validation)

How to do it?

In web application we can perform such task via javascript, how to perform client side form validation in the windows form application?

推荐答案

^ ]是必经之路.

验证 [
Regular Expressions[^] is the way to go.

Validation[^] is obvious too.


WinForms应用程序中没有客户端这样的东西.该应用程序始终在客户端上运行.

有许多可用的验证控件,无需花费很多精力就可以找到有关它们的文档
There is no such thing as client-side in WinForms app. The app is always run on the client.

There are many Validation controls available and it doesn''t take much effort to find documentation about them


这篇关于C#Windows窗体应用程序中的客户端窗体验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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