Results 1 to 9 of 9

Thread: Web Browser Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    5

    Web Browser Control

    Anybody who knows-

    I have a WB control in my app that only accesses local files in offline mode. My app modifies CSS and writes them back to the drive. I would like to refresh the page in the WB Control to show the changes.

    I tried the Refresh() method, which does nothing. I don't want to have to re-navigate to the page, because you then lose the position you were at in the page.

    Any ideas?

    Thanks-
    Erik

  2. #2
    Addicted Member
    Join Date
    Aug 2003
    Location
    Singapore
    Posts
    245

    Lightbulb May i Suggest

    May be this helps...
    U Need to Navigate Back to The Same Page!
    You won't loose the locations if the URL is kept somewhere
    In a Control or Variables.
    VB Code:
    1. Private Sub Command1_Click()
    2.     With WebB
    3.     .Navigate "http://www.anywhere.com"
    4.     End With
    5. End Sub
    I may have interpret your post wrongly
    Correct me if I made a mistake...
    Hope This Helps.. .....Enjoy Coding.....//


    zak2zak

  3. #3
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    WebBrowser1.Refresh should work just fine, but anyway here is another way to do it.

    Code:
    WebBrowser1.Document.location.reload

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    5
    I tried both of these methods. Unfortunately, they both still take me back to the top of the html page when they Navigate() or reload().

    Is there any way to get/set a property that tells you how far down in a page you are, that you can set when the page reloads?

    Thanks for your suggestions-
    Erik

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    5
    BTW, I am using VB.NET, if that makes a difference.

    Thanks-
    Erik

    Edited & added: Oh yeah, and also, I AM able to refresh it manually by right clicking and choosing "Refresh" when the app is running. Why won't the code do this?

    I even tried doing a sendkey in the code:

    System.Windows.Forms.SendKeys.Send("{f5}")

    While manually hitting F5 when the program runs takes you back to the right spot in the page, using the sendkey command causes it to go back to the top of the page, yet again!
    Last edited by Erik Johnson; Aug 14th, 2003 at 03:39 PM.

  6. #6
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    Originally posted by Erik Johnson
    I tried both of these methods. Unfortunately, they both still take me back to the top of the html page when they Navigate() or reload().

    Is there any way to get/set a property that tells you how far down in a page you are, that you can set when the page reloads?

    Thanks for your suggestions-
    Erik
    Refresh is how to do it..... and I dont believe what you want is possible (at least built into the web control). you might be able to get the scroll bar value with SendMessage and then reset that value after u refresh the page.....

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    5
    How exactly would I get the scroll bar value with SendMessage? Will I have a hard time trying to figure that out if I don't already know how to do it?

    Thanks for your help-
    ERik

  8. #8
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    check out the WM_* messages in the MSDN and look for the one you want (if it exists) ..... Another option would be to subclass the webbrowser control and intercept the WM_VSCROLL / WM_HSCROLL messages and keep saving the last position.

  9. #9

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    5
    On a whim, I tried this:

    WBControl.ExecWB(SHDocVw.OLECMDID.OLECMDID_REFRESH, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER)

    AND IT WORKS!!!

    Thanks-
    Erik

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