|
-
Feb 13th, 2008, 03:34 AM
#1
Thread Starter
Addicted Member
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?
-
Feb 13th, 2008, 07:07 AM
#2
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.
-
Feb 13th, 2008, 07:50 AM
#3
Thread Starter
Addicted Member
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.
Last edited by glug; Feb 13th, 2008 at 07:54 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|