Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27472

VS 2010 Multiple Style Changes On A Html Element

$
0
0
Hi. I have 1 webbrowser and 2 buttons on my form. After the site gets loaded, I press on a section of the site itself, click the first button to change the style of the html element (works well) and then I click on the second style button, what happens is that the first styling is removed and the second one is applied.

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://www.yahoo.com/")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Document.ActiveElement.Style = "color:blue"
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.Document.ActiveElement.Style = "border:dotted"
End Sub

How to keep the old style changes and add new ones?
Also, could it be possible to change 2 different styles of a html element with one code line, something like:
WebBrowser1.Document.ActiveElement.Style = "color:blue" & "border:dotted"

Viewing all articles
Browse latest Browse all 27472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>