Results 1 to 9 of 9

Thread: [RESOLVED]Object reference not set to an instance of an object.[Help]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    297

    Resolved [RESOLVED]Object reference not set to an instance of an object.[Help]

    Ok guys. Im trying to grab a HTML element style with my program, the problem is that when the page is loaded there is no style to that element, then if I click on that element and it has a style.

    I have this

    vb.net Code:
    1. With WebBrowser1
    2.  
    3.  
    4.                 If .Document.GetElementById("idSUOther9").Style is Nothing Then
    5.                     .Document.GetElementById("i1668").InvokeMember("click")
    6.                 End If
    7.                 If .Document.GetElementById("idSUOther9").Style Is "display: none;" Then
    8.                     .Document.GetElementById("i0116")
    9.                     .Document.GetElementById("i0118")
    10.  
    11.                 End If
    12.                 tLogin.Stop()
    13.                 MessageBox.Show(.Document.GetElementById("idSUOther9").Style)
    14.                 Return

    then my program crashes here

    vb.net Code:
    1. If .Document.GetElementById("idSUOther9").Style is Nothing Then
    2.                     .Document.GetElementById("i1668").InvokeMember("click")
    3.                 End If

    since idSUOther9 there is no style it cant grab its data. How can I check is "idSUOther9" has a style without crashing my program?

    Thank you
    Last edited by simon66; Jul 20th, 2010 at 01:01 PM.

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