none
How to get html style attribute in vb.net? RRS feed

  • Question

  • Hi

    I used axWebbrowser to access html.

    But I got some problem with getting style attribute.

    Dim doc As HTMLDocument
    Dim ele_2 As IHTMLElement2
    
    doc = WebBrowser1.Document
    ele = doc.getElementById("eleID")
    
    Debug.Print ele_2.style.display

    It always return "Nothing" and I found that ele_2.style was return {System.__ComObject} .

    Is there another way to get style attribute?

    Wednesday, August 30, 2017 2:53 AM

Answers

  • Hi Eva,Hung,

    Please try to use ele_2.Style, which works on my side.

    Dim doc As HtmlDocument Dim ele_2 As HtmlElementdoc = WebBrowser1.Document ele_2 = doc.GetElementById("eleID") MessageBox.Show(ele_2.Style)


    Best regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, August 30, 2017 7:28 AM
    Moderator

All replies

  • Have you tried ele_2.getAttribute("style")?


    • Edited by Viorel_MVP Wednesday, August 30, 2017 5:50 AM
    Wednesday, August 30, 2017 5:49 AM
  • Hi Eva,Hung,

    Please try to use ele_2.Style, which works on my side.

    Dim doc As HtmlDocument Dim ele_2 As HtmlElementdoc = WebBrowser1.Document ele_2 = doc.GetElementById("eleID") MessageBox.Show(ele_2.Style)


    Best regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, August 30, 2017 7:28 AM
    Moderator