Web Browser question

Discussion in 'Code Snippets and Tutorials' started by Fexxel, Mar 28, 2009.

  1. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    I'm trying to create a web browser window for an application I'm making...
    How do I get a button to refresh the content in the web browser?
    Thanks in advance,
    Fexxel
     
  2. Will

    Will Level IV

    Joined:
    Mar 1, 2009
    Messages:
    1,067
    Likes Received:
    53
    Double click your refresh button, and put this in:

    Code (Text):
    1.  
    2. on error goto err:
    3. If tabstrip1.selecteditem.index = 1 then 'webbrowser 1 selected
    4. wbmain.refresh
    5.  
    6. elseif tabstrip1.selecteditem.index = 2 then 'wb 2 selected
    7. wbmain2.refresh
    8. End If
    9. err:
    Assuming your elements are named as follows, and you are creating a tabbed web-browser:

    Naming conventions:
    WebBrowsers - wbmain, wbmain2
    TabStrips - tabstrip1
    cmdrefresh
     
  3. Fexxel

    Fexxel Level IV

    Joined:
    Jan 28, 2009
    Messages:
    959
    Likes Received:
    26
    Sorry will but that's not really what I'm talking about...
    1. I'm not doing a tab browser... xD?
    2. I don't want it to do something on error. I'm not making an "if/then" statement. I'm issueing a single command and a repeat.
    The single command is to refresh and the repeat is. Well. However to repeat the command.
    Are you saying its WebBrowswer1.refresh ?
    In that case, could I do WebBrowser1.Refresh(10) to refresh 10 times?
     
  4. Will

    Will Level IV

    Joined:
    Mar 1, 2009
    Messages:
    1,067
    Likes Received:
    53



    Oh, I overcomplicated things :/ Sorry.. I have a tendency for doing that

    I think this is what you want:

    Code (Text):
    1. Private Sub cmdrefresh_Click()
    2. WebBrowser1.Refresh
    3. End Sub
    That's as simple as it comes for a refresh button :/
     
  5. ricky92

    ricky92 Administrator
    Staff Member

    Joined:
    Nov 10, 2006
    Messages:
    1,866
    Likes Received:
    67
    Fexxel, I have the feeling you didn't even try reading one of the many vb.net tutorials... You won't learn anything this way, believe me.
    Google is your friend. ;)

    Hint: There's something called "For... Next"... google it.
     
  6. Heya_old

    Heya_old Level IV

    Joined:
    Mar 31, 2008
    Messages:
    928
    Likes Received:
    46
    ricky, you are 100% correct :p Google is your friend :p what i do is i look and look and look, and if i still can't find what i'm looking for on google after 20-30 minutes of looking, then i turn for help :p Google has helped me sooo many times when i'm programming though :p

    simply, if you had googled it, especially something this big, you would of gotten tons of results, as its just a simple command...
     
  7. Snowmanny

    Snowmanny Level III

    Joined:
    Mar 11, 2008
    Messages:
    469
    Likes Received:
    10
    Location:
    Toronto Canada
    ya you can google almost anything for programming, except for wrappers and that kind of stuff...

    if you want to see all the list of commands your webbrowser can do just type

    webbrowser. into your form, and it will suggest like 10 things you can do (refresh/navigate/goback/goforward, ect..)