Results 1 to 4 of 4

Thread: NullException Error help.

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Colorado
    Posts
    83

    NullException Error help.

    With the code below Im getting NullException with the If statements. Where If the user enters nothing "" then the
    message box shows. Any Idea's what Im doing wrong?

    Code:
    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
    
            Dim sUserID As String
            Dim sPass As String
    
            If sUserID.Trim() = "" Then
    
                MessageBox.Show("UserID cannot be blank," _
                & "Please endter a proper UserID.", "Error", _
                MessageBoxButtons.OK, MessageBoxIcon.Error)
                txtUserID.Select()
            Else
                If sPass.Trim() = "" Then
                    MessageBox.Show("Password cannot be blank," _
                    & "Please enter a proper password.", "Error", _
                    MessageBoxButtons.OK, MessageBoxIcon.Error)
                    txtPass.Select()
                Else
                    Me.DialogResult = DialogResult.OK
                End If
            End If
        End Sub
    Last edited by Jes|er; Feb 23rd, 2002 at 08:20 PM.
    12/32/84 - I need some code to make me a sandwhich.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width