Results 1 to 3 of 3

Thread: progressbar and web browser

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2007
    Posts
    228

    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?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: progressbar and web browser

    What do you think this code does?
    vb.net Code:
    1. 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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2007
    Posts
    228

    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
  •  



Click Here to Expand Forum to Full Width