Results 1 to 7 of 7

Thread: [RESOLVED] [2005] How to get around error 91

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Location
    London, England
    Posts
    142

    Resolved [RESOLVED] [2005] How to get around error 91

    Hey folks, I've been working on adding a couple of search engines to my IE clone, but everytime i run the program, i always get this msg

    Object reference not set to an instance of an object. Error Number: 91
    the documentation on .GetElementById and .InvokeMember is sketchy at best, i've tried msdn, this forum, google, and all the other tricks i know, can anyone help?

    Here's my code

    VB Code:
    1. Private Sub doSearchQuery()
    2.         Dim google As String = "http://www.google.com/search?hl=en&q=" 'Google's search engine string
    3.         Dim yahoo As String = "http://search.yahoo.com/search;_ylt=A0geuoxASo1FZw4AFj2l87UF?ei=UTF-8&fr=sfp&p=" 'Yahoo's search engine string
    4.         Dim googleId As String = "btnG"
    5.         Dim Click As String = "click"
    6.         'Dim helement As New HtmlElement
    7.  
    8.         Try
    9.  
    10.             If lbSearchSelect = "Google" Then
    11.                 wbPKMN.Navigate(google & SearchString) 'Navigate to google
    12.                 wbPKMN.Document.GetElementById("btnG").InvokeMember(Click)
    13.  
    14.             Else
    15.                 wbPKMN.Navigate(yahoo & SearchString) 'navigate to yahoo
    16.                 wbPKMN.Document.GetElementById("yschqcon").InvokeMember(Click)
    17.             End If
    18.         Catch ex As Exception
    19.             nwWriteLogMsg(ex.Message, ".\nwpps2k6err.log", ex.StackTrace, ex.TargetSite.ToString, ex.Source, ex.HelpLink)
    20.             With frmException
    21.                 .lblTitle.Text = "UriFormatException"
    22.                 .txtDesc.Text = ex.Message & " Error Number: " & Err.Number
    23.                 .lblSource.Text = ex.Source
    24.                 .lblTargetMethod.Text = ex.TargetSite.ToString
    25.                 .ctbSTrace.Text = ex.StackTrace
    26.                 .ShowDialog(Me)
    27.             End With
    28.         End Try
    29.  
    30.         LbSearch.Hide()
    31.     End Sub

    The funny thing about this is, it works, even though it's throwing that error everytime. Just wonder if there's a way around it

    Redmo
    Last edited by redmo; Jan 3rd, 2007 at 03:59 AM. Reason: Including whole code block
    The universal aptitude for ineptitude makes any human accomplishment an incredible miracle -Col. John P. Stapp


    Please rate the posts that have helped. Makes us feel all warm and fuzzy

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