6

外側の if ステートメントを削除すると、クリックするとフィールドにaddmessageジャンプするリンクが作成されます。txtBillTxtSetSrcif ステートメント内にリンクが表示されます

Microsoft JScript ランタイム エラー: オブジェクトが必要です".

if ステートメントなしで動作します。なぜそれがうまくいかないのですか?

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
4

1 に答える 1

1

使用時にtxtBillTxtSetSrcが有効であることを確認してください。Nothing(null) の場合、.Text プロパティなどにアクセスできません。また、それが何かである場合、それはプロパティの 1 つである可能性があります。私はそれらを1つずつチェックします。

 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
于 2013-07-29T18:54:59.117 に答える