progressbar and web browser
Hi Guys
I've searched google and can only come up with answeres using the webbrowser control and the ProgressChanged event.
using the properties of
Code:
Me.ToolStripProgressBar1.Maximum = e.MaximumProgress
Me.ToolStripProgressBar1.Value = e.CurrentProgress
I am not using the webbrowser control but declairing a vairable as type Webbrowser.
Code:
dim browser as Webbrowser = new webbbrowser
How can i use the progressbar with this browser i just declaired?
Re: progressbar and web browser
What do you think this code does?
vb.net Code:
dim browser as Webbrowser = new webbbrowser
It creates a new WebBrowser control. The very WebBrowser control you say you aren't using.
If you aren't displaying the WebBrowser control to the user then it's pointless. Just use a WebClient object instead. If you are showing the WebBrowser to the user then handle its ProgressChanged event as you already know how to. You attach a method to the event with the AddHandler statement, the same as you do for any objects, controls or otherwise, created at run-time.
Re: progressbar and web browser
Thanks. I have two text boxes on my form. username ans password.
With the webbrowser i navigate to the url and then use GetElementByID
Code:
Dim elemEmail As HtmlElement
Dim elemPassword As HtmlElement
Dim elemSubmit As HtmlElement
Try
'Gets the elements ID "email and password"
elemEmail = browser.Document.GetElementById("login_name")
elemPassword = browser.Document.GetElementById("password")
'inserts the email and password into the Webbrowser textboxes
elemEmail.InnerText = email
elemPassword.InnerText = password
elemSubmit = browser.Document.Forms(0)
'clicks on the login button
elemSubmit.InvokeMember("submit")
Return True
Catch ex As Exception
Return False
End Try
This is my function that insert text into the username and password
for a certain website. The user musn't see the webbrowser
How is this suppose to be done using the WebClient? I cant find anything in the properties.