H
Habib ur rehman
Guest
Is there any way to validate multiple textboxes an easy way.
Currently I am doing it using this method which is Lengthy approach.
Private Sub Textboxes_Leave(sender As Object, e As EventArgs) Handles TB1.Leave,
TB2.Leave, TB3.Leave, TB4.Leave
Dim TBName As TextBox = CType(sender, TextBox)
If TBName.Name = TB1.Name And TBName.Text <> "" Then
If TBName.Text.Trim = TB2.Text.Trim Or TBName.Text.Trim = TB3.Text.Trim Or
TBName.Text.Trim = TB_1d2dC4.Text.Trim Then
MsgBox("Similarity found.")
End If
ElseIf TBName.Name = TB2.Name And TBName.Text <> "" Then
If TBName.Text.Trim = TB1.Text.Trim Or TBName.Text.Trim = TB3.Text.Trim Or
TBName.Text.Trim = TB_4.Text.Trim Then
MsgBox("Similarity found.")
End If
End If
ElseIf TBName.Name = TB3.Name And TBName.Text <> "" Then
If TBName.Text.Trim = TB1.Text.Trim Or TBName.Text.Trim = TB2.Text.Trim Or
TBName.Text.Trim = TB_4.Text.Trim Then
MsgBox("Similarity found.")
End If
End If
End Sub
Continue reading...
Currently I am doing it using this method which is Lengthy approach.
Private Sub Textboxes_Leave(sender As Object, e As EventArgs) Handles TB1.Leave,
TB2.Leave, TB3.Leave, TB4.Leave
Dim TBName As TextBox = CType(sender, TextBox)
If TBName.Name = TB1.Name And TBName.Text <> "" Then
If TBName.Text.Trim = TB2.Text.Trim Or TBName.Text.Trim = TB3.Text.Trim Or
TBName.Text.Trim = TB_1d2dC4.Text.Trim Then
MsgBox("Similarity found.")
End If
ElseIf TBName.Name = TB2.Name And TBName.Text <> "" Then
If TBName.Text.Trim = TB1.Text.Trim Or TBName.Text.Trim = TB3.Text.Trim Or
TBName.Text.Trim = TB_4.Text.Trim Then
MsgBox("Similarity found.")
End If
End If
ElseIf TBName.Name = TB3.Name And TBName.Text <> "" Then
If TBName.Text.Trim = TB1.Text.Trim Or TBName.Text.Trim = TB2.Text.Trim Or
TBName.Text.Trim = TB_4.Text.Trim Then
MsgBox("Similarity found.")
End If
End If
End Sub
Continue reading...