English 中文(简体)
C# Winforms文本箱的审定投入
原标题:Validating input for Textbox on C# Winforms

我试图证实,对C#胜诉文本箱的投入符合有效模式。

模式必须是一种扼杀,只包含以下特性:

  • 0 to 9
  • A to Z
  • "-"
  • "/"

我正在考虑利用文本箱上的“变造”活动来进行验证,但我正在与正确的定期表达方式作斗争,以便使用——或者可能比使用定期表达方式更好。

最佳回答

The regex "[A-Z0-9_/] should do it. 只要你乐意使用这些软件,雷克似乎就象这里最明显的选择(它非常简单的验证)。

或许需要援引某些特殊性,取决于你们选择的语言。 如果你也像允许少发案信一样,那么“[a-zA-Z0-9_/]”。

或者,“(w?d???)+”这样的东西可能奏效——其体与任何特性相匹配,是任何数字。 ? 这与以前的第0号或第1条相匹配,而“+”最终允许其中多项相匹配。

问题回答

您可以就文本Box开展一次重要活动,如果主要发明家的香灰压力不是你想要接受的特性之一,那么,就将予以肯定。 您可以通过检查主要创新企业的主要领域来检查其特性。 这将使用户试图打造一种并非你想要的特性,不会发生。





相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签