Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net VB.net Object not set to an instance of an object

Hi
I am getting the error "Object not set to an instance of an object" in the following ASP.net VB.net code. This doesn't make any sense

Dim S As String
S = "Select Top 1 [Drilled To] From Performance"
ASKER CERTIFIED SOLUTION
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Hi. Sorry this took so long but here is the rest of the code
    Sub oSave()

        Me.lblSave.Text = ""
        Me.lblError.Text = ""
        Dim S As String = ""

        Try

            Dim oHoleNumber As String
            If txtOtherHoleNumber.Text = "" Then
                oHoleNumber = Me.DropDownList_HoleNumber.Text
            Else
                oHoleNumber = Me.txtOtherHoleNumber.Text
            End If
            S = "Select Top 1"
            S = S & "[Drilled To] From Performance"
            S = S & " Where [Hole Number] = '" & oHoleNumber & "'"
            S = S & " Order By [ID] Desc"  

        Catch ex As Exception
            Me.lblError.Text = ex.Message
        End Try
    End Sub

Open in new window

Avatar of Andy Edwards
Andy Edwards

That is odd it looks ok however what if DropDownList_HoleNumber has  nothing selected when Me.txtOtherHoleNumber.Text is empty
Thanks