2013-01-10 85 views
-1

我的表單中有五個蒙面文本框。兩個帶日期格式的蒙面文本框,兩個用錢和一個用電話號碼。我使用下面給出的代碼來檢查這些框是否爲空。檢查蒙面文本框

Dim mtxt As Control 
    Dim flagmtxt As Boolean 
    flagmtxt = False 
    For Each mtxt In EMPGBDATA.Controls 
     If TypeOf mtxt Is MaskedTextBox Then 
      If mtxt.Text = "" Then 
       mtxt.BackColor = Color.Red 
       flagmtxt = True 
      End If 
     End If 
    Next 

    If flagmtxt Then 
     MessageBox.Show("Give Compleate Data!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning) 
    End If 

我想避免檢查工資格式的蒙面文本框。有沒有機會?

回答

0
flagmtxt = False 
    For Each mtxt In EMPGBDATA.Controls 
     If TypeOf mtxt Is MaskedTextBox Then 
      If mtxt.Text = "" And mtxt.Name <> "MTXTPFESI" Then 
       flagmtxt = True 
      Else 
       flagmtxt = False 
      End If 
     End If 
    Next