空白蒙版文本框的错误消息 [英] Error Messge for blank Masked Text Box
本文介绍了空白蒙版文本框的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用VB2010.我正在尝试使用户在文本框中输入文本,而不是将其留空.这就是我所拥有的...
I am using VB 2010. I am trying to make the user input text into a textbox and not leave it blank. This is what I have...
If ZipMaskedTextBox.Text = "" Then
MessageBox.Show("Must enter Zip Code", "Missing Information", MessageBoxButtons.OK, MessageBoxIcon.Error)
ZipMaskedTextBox.Focus()
Exit Sub
End If
推荐答案
尝试以下操作:
Try this:
Private Sub MaskedTextBox1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MaskedTextBox1.Leave
If Me.MaskedTextBox1.Text.Length <> Me.MaskedTextBox1.Mask.Length Then
MsgBox("Must enter Zip Code", MsgBoxStyle.Information, "Error...")
Me.MaskedTextBox1.Focus()
End If
End Sub
这篇关于空白蒙版文本框的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文