[英]Separate Number using Masked textbox
I don't know how to work with this, I have this who's input will be a valid sss or tin number (eg 111-1111-111) 我不知道该如何使用,我要输入的是有效的sss或tin编号(例如111-1111-111)
and my code is: 我的代码是:
Public Class Form1
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text.Length = 4 Then
TextBox1.Text &= "-"
TextBox1.Select(TextBox1.Text.Length, 0)
ElseIf TextBox1.Text.Length = 11 Then
TextBox1.Text &= "-"
TextBox1.Select(TextBox1.Text.Length, 0)
End If
End Sub
End Class
Use a MaskedTextBox and set the Mask()
property to 0000-000000-000
. 使用MaskedTextBox并将Mask()
属性设置为0000-000000-000
。 The dash will be inserted for you as the digits are typed. 在输入数字时,将为您插入破折号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.