Question

I have five masked text box in my form. Two masked text box with date format, two with money and one with phone number. i am using code given below for checking these boxes are empty or not.

    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

I want to avoid checking of masked text box with salary format. Is there any chance??

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top