When I remove the outside if statement, addmessage
will create a link that will jump to the txtBillTxtSetSrc
field when clicked. Inside of the if statement the link displays
Microsoft JScript runtime error: Object expected".
It works without the if statement. Why does it not work with it?
If Me.txtBillTxtSetSrc.Text.Trim.Length > 0 Then
validateExpression = "^[BCGHJSR][0-9][0-9]"
ismatch = Regex.IsMatch((txtBillTxtSetSrc.Text).ToUpper, validateExpression)
If ismatch = False Then
tempErrorMsg = LASPBS_Classes.Errors.MainframeError.getError("281W") ' Text Set Must be B01-B99, etc.
Me.MessageCenter.addMessage(tempErrorMsg, "#", "txtBillTxtSetSrc", "form1", "E")
Me.MessageCenter.Visible = True
End If
End If
check to make sure txtBillTxtSetSrc is valid at the time of usage. If it is Nothing(null) then you cant access the .Text property and so on. Also if it is something it could be one of the properties. I would check them on by one.
If Not (Me.txtBillTxtSetSrc is Nothing) andalso (Me.txtBillTxtSetSrc.Text.Trim.Length > 0) Then
validateExpression = "^[BCGHJSR][0-9][0-9]"
ismatch = Regex.IsMatch((txtBillTxtSetSrc.Text).ToUpper, validateExpression)
If ismatch = False Then
tempErrorMsg = LASPBS_Classes.Errors.MainframeError.getError("281W") ' Text Set Must be B01-B99, etc.
Me.MessageCenter.addMessage(tempErrorMsg, "#", "txtBillTxtSetSrc", "form1", "E")
Me.MessageCenter.Visible = True
End If
End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With