简体   繁体   English

计算蒙版文本框中的字符以进行检查

[英]count characters in a masked textbox for check

I am using a masked TextBox, and I would like to check the input (total characters must be 14), is there a property for the masked TextBox to handle this or should I use a function? 我使用的是带遮罩的TextBox,我想检查输入(字符总数必须为14),带遮罩的TextBox是否有属性可以处理此问题,还是应该使用函数? Can someone help me? 有人能帮我吗?

You should be able to do it with this: 您应该能够做到这一点:

' Remove spaces
Dim textNoSpaces As String = TextBox1.Text.Replace(" ", "")

If textNoSpaces.Length <> 14 Then
    ' Do something here
Else
    ' Do something else, if desired
End If

The masking is a display thing, it has nothing to do with the actual string entered by the user. 掩蔽是一种显示,它与用户输入的实际字符串无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM