Page 2 of 3 FirstFirst 123 LastLast
Results 41 to 80 of 108

Thread: vb web browser tutorial

  1. #41
    New Member
    Join Date
    Feb 2008
    Posts
    2

    Re: vb web browser tutorial

    nice work & gud going guyz

  2. #42
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: vb web browser tutorial

    Would be nice if you also explained how to submit forms and stuff, since sometimes it's just easier doing it with the WebBrowser control.

  3. #43
    Lively Member
    Join Date
    Mar 2008
    Posts
    92

    Re: vb web browser tutorial

    Quote Originally Posted by MSWindowsUser
    Do you have VB6 on your PC? If so, download mine.

    Blocks Pop-ups and you can still open links in a new window.
    Hey man.
    I have been making my web browser, and it rocks!!
    but i downloaded yours, and was interested to see the "File, Tools, Internet Options"
    This looks like a hugely useful tool, but i cant make it work!!!

    What code did you use to open the Internet Options please??

    Thanks man!

  4. #44
    Lively Member
    Join Date
    Mar 2008
    Posts
    92

    Re: vb web browser tutorial

    Here is the code i am using just now for my Internet Options button

    It doesnt work
    can you help plz?

    vb Code:
    1. Private Sub IOptions_Click()
    2. Shell ("Control Panel/Internet Options")
    3. End Sub

  5. #45
    Lively Member
    Join Date
    Mar 2008
    Posts
    92

    Re: vb web browser tutorial

    Never mind, Hack helped me

    if anyone is interested, the code to launch internet options is...

    vb Code:
    1. Private Sub IOptions_Click()
    2. Shell "C:\Windows\System32\control.exe" & " Inetcpl.cpl", 1
    3. End Sub

  6. #46
    Member
    Join Date
    Apr 2008
    Posts
    39

    Re: vb web browser tutorial

    Is there a way to encrypt URLs you enter into the combobox?
    Last edited by joebobfrank; Jun 22nd, 2008 at 06:28 PM.

  7. #47
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: vb web browser tutorial

    That is not an acceptable question to ask on this site.

    Assisting in violating your schools rules or security systems (no matter how justified you think it is) is against our rules - see the Acceptable Use Policy link at the bottom of all VBForums pages.

  8. #48
    Member
    Join Date
    Apr 2008
    Posts
    39

    Re: vb web browser tutorial

    that was just an example so that people would get what i meant, I'm not going to use it for malicious purposes, that would get me banned from the school computers.

    and besides, if I wanted to do that I'd just use a proxy; there are hundreds of them lying around the interwebs.

    Is it even possible to encrypt all URLs passing through the browser?
    Last edited by joebobfrank; Jun 23rd, 2008 at 12:24 AM.

  9. #49
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: vb web browser tutorial

    I'm not aware of any valid reason for doing that - only for bypassing security systems (which often block proxies).

    As you have not given another reason, I have serious doubts of your intentions, and cannot allow an answer (from anyone) unless you send me a valid reason via Private Message.

  10. #50
    Member
    Join Date
    Apr 2008
    Posts
    39

    Re: vb web browser tutorial

    Code:
    Private Sub WebBrowser1_TitleChange(ByVal Text As String)
        Form1.Caption = WebBrowser1.LocationName
    End Sub
    Show page title in the forms caption.

  11. #51
    Lively Member
    Join Date
    Mar 2008
    Posts
    92

    Re: vb web browser tutorial

    Quote Originally Posted by joebobfrank
    Code:
    Private Sub WebBrowser1_TitleChange(ByVal Text As String)
        Form1.Caption = WebBrowser1.LocationName
    End Sub
    Show page title in the forms caption.
    why did you post that?!

  12. #52
    Member
    Join Date
    Apr 2008
    Posts
    39

    Re: vb web browser tutorial

    It's a useful thing for a web browser to show page title... just posting code in the codebank...
    Last edited by joebobfrank; Jun 23rd, 2008 at 09:54 PM.

  13. #53
    Member
    Join Date
    Apr 2008
    Posts
    39

    Re: vb web browser tutorial

    Ok here's how to open up the page source in notepad and not keep it stored on your hard drive (so you don't have to manually delete the source code text files)

    Code:
     
    
    Private Sub MenuSource_Click()
    Text1.Text = Form1.WebBrowser1.Document.documentElement.innerHTML
        Dim hFile As Long
       Dim sFilename As String
    
       sFilename = "c:\tempsource.txt"
       
      'obtain the next free file handle from the
      'system and and save the text box contents
       hFile = FreeFile
       Open sFilename For Output As #hFile
          Print #hFile, Text1.Text
       Close #hFile
       
       
       Dim strtest As String
        Dim FileSystemObject As Object
        strtest = "notepad c:\tempsource.txt"
    
       Shell strtest, vbNormalFocus
       
       Kill "c:\tempsource.txt"
    End Sub

    Another thing to add to the tutorial

    Code:
    Private Sub MenuFind_Click()
        WebBrowser1.ExecWB OLECMDID_FIND, OLECMDEXECOPT_DODEFAULT
    End Sub
    Last edited by joebobfrank; Jun 23rd, 2008 at 10:17 PM.

  14. #54
    New Member
    Join Date
    Oct 2008
    Posts
    2

    Re: vb web browser tutorial

    Quote Originally Posted by MSWindowsUser
    Do you have VB6 on your PC? If so, download mine.

    Blocks Pop-ups and you can still open links in a new window.
    What is the code for the status bar? How do you do it? Sorry I'm noob.

  15. #55
    New Member
    Join Date
    Oct 2008
    Posts
    2

    Re: vb web browser tutorial

    i keep on getting this error
    Run-time error '-1 (ffffffff)'
    when i put these codes
    Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    On Error Resume Next
    Dim i As Integer
    Dim bFound As Boolean
    Me.Caption = WebBrowser1.LocationName
    For i = 0 To cboAddress.ListCount - 1
    If cboAddress.List(i) = WebBrowser1.LocationURL Then
    bFound = True
    Exit For
    End If
    Next i
    mbdontnavigatenow = True
    If bFound Then
    cboAddress.RemoveItem i
    End If
    cboAddress.AddItem WebBrowser1.LocationURL, 0
    cboAddress.ListIndex = 0
    mbdontnavigatenow = False
    End Sub

    what will i do?
    doesn't mbdontnavigatenow needs to be declared?

  16. #56
    Member MSWindowsUser's Avatar
    Join Date
    Dec 2007
    Posts
    40

    Re: vb web browser tutorial

    Quote Originally Posted by vbnoobie
    i keep on getting this error
    Run-time error '-1 (ffffffff)'
    when i put these codes
    Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    On Error Resume Next
    Dim i As Integer
    Dim bFound As Boolean
    Me.Caption = WebBrowser1.LocationName
    For i = 0 To cboAddress.ListCount - 1
    If cboAddress.List(i) = WebBrowser1.LocationURL Then
    bFound = True
    Exit For
    End If
    Next i
    mbdontnavigatenow = True
    If bFound Then
    cboAddress.RemoveItem i
    End If
    cboAddress.AddItem WebBrowser1.LocationURL, 0
    cboAddress.ListIndex = 0
    mbdontnavigatenow = False
    End Sub

    what will i do?
    doesn't mbdontnavigatenow needs to be declared?
    Under Option Explicit
    Type in Private mbdontnavigatenow as Boolean.

    That will work. Trust me.

    Code:
    Option Eplicit
    Private mbdontnavigatenow as Boolean
    The other codes go below the "Option Explicit" and "Private mbdontnavigatenow as Boolean" lines

  17. #57
    Lively Member
    Join Date
    Apr 2008
    Posts
    81

    Thumbs down Re: vb web browser tutorial

    Yeah, im missing basic components in my vb6 app

    "Microsoft html object library" and "Microsoft internet controls"

  18. #58
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: vb web browser tutorial

    Browse to your system directory and add them

    Microsoft HTML Object Library ---> mshtml.tbl
    Microsoft Internet Controls ------> shdocvw.dll

  19. #59
    Lively Member
    Join Date
    Apr 2008
    Posts
    81

    Re: vb web browser tutorial

    Quote Originally Posted by jmsrickland
    Browse to your system directory and add them

    Microsoft HTML Object Library ---> mshtml.tbl
    Microsoft Internet Controls ------> shdocvw.dll
    mshtml.tbl is missing

    I find mshtml.dll but cant be added anyway

  20. #60
    Lively Member
    Join Date
    Apr 2008
    Posts
    81

    Re: vb web browser tutorial

    getting runtime error '-2(fffffffe)'

  21. #61
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: vb web browser tutorial

    Sorry about the misspell: It should be mshtml.tlb not mshtml.tbl

  22. #62
    Lively Member
    Join Date
    Apr 2008
    Posts
    81

    Re: vb web browser tutorial

    Quote Originally Posted by jmsrickland
    Sorry about the misspell: It should be mshtml.tlb not mshtml.tbl
    yeah i tried em both

  23. #63
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: vb web browser tutorial

    You were able to add the DLL, right, but not the mshtml.tlb?

    Don't know exactly how you are doing it but the mshtml.tlb should be added to the reference list (not the components list). Is this what you are trying to do with out success?

  24. #64
    Lively Member yomamathecableguy's Avatar
    Join Date
    Jun 2008
    Posts
    67

    Re: vb web browser tutorial

    this is an awesome tutorial thanks!! ^_^
    New to the WebBrowser Control? Start here -
    VB6 WebBrowser Control
    Looking to make a full out Web Browser? Here's a great reference -
    VB6 Web Browser
    Need to make a custom right-click menu? Check here -
    VB Right-Click Menus

    Have I helped you out with something? Rate me!

  25. #65
    Member
    Join Date
    Oct 2008
    Posts
    34

    Re: vb web browser tutorial

    How can I make a Tabbed webbrowser with TabStrips???? I have been looking for this for 2 days!!! Please help me!!!

    I mean: When I click CommandButton1, then in tabStrip a second Tab appears with a second Webbrowser (like in IE7, Mozilla, Opera,....)


    All I can find on website's Is Tabs for VB.net or VB2008 but NOTHING for VB6!! Please help!!

  26. #66

    Re: vb web browser tutorial

    I am also trying to get a tabbed web browser, but on the moment I have problems with my progressbar. My progressbar doesn't stay on the place I want it to have with my screen maximized. If I resize my screen it replaces perfectly.

    If someone could help me with Tabs or my progressbar, I would really appreciate that.
    Last edited by Smak_Rice; Nov 24th, 2008 at 11:01 AM.

  27. #67
    Addicted Member
    Join Date
    Dec 2008
    Posts
    217

    Re: vb web browser tutorial

    Using the method in the tutorial, how could you display the blocked pop-up? Using Internet Explorer 7, it displays the yellow bar and you have the option of allowing the pop-up, but it refreshes the page in order to do it. I've managed to achieve the same effect, however, is there a way of doing it without refreshing?

  28. #68
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    355

    Re: vb web browser tutorial

    Quote Originally Posted by MSWindowsUser View Post
    Do you have VB6 on your PC? If so, download mine.

    Blocks Pop-ups and you can still open links in a new window.
    I have been looking for a way to open links in new window when a user RIGHT clicks on the menu and selects Open In New Window. This app is the only one I found that opens a new window,,, but there is no Source for VB6...

    Can anyone supply the actual example on HOW TO open a a link in new window when user right clicks on the link and selects OPEN IN NEW WINDOW

  29. #69
    Member
    Join Date
    Nov 2008
    Posts
    35

    Re: vb web browser tutorial

    I have tried to use this tutorial to open up a web page, fill out a form (you put in an IP address and info about that address comes out after submission) and extract the data from the form.

    It works in the web browser window, I display the data from the filled out form successfully.

    However, after the data is displayed the "WebBrowser1.Document.body.innerHTML" values do not match the displayed information.

    Why is this.

    Here is my code-

    Code:
    Private Sub Command1_Click()
    Dim doc As HTMLDocument
    Dim strHTML As String
    
    'go to the altavista (text) search page
    WebBrowser1.Navigate "http://www.ip2location.com/free.asp"
    'Wait until page is loaded
    Do
    DoEvents
    Loop Until Not WebBrowser1.Busy
    
    'Make doc reference to the document inside the webbrowser control
    Set doc = WebBrowser1.Document
    
    'Set field ipaddresses with the value of Text1
    SetInputField doc, 0, "ipaddresses", Text1
    
    'Submit the form
    doc.Forms(0).submit
    
    'Wait until result are loaded
    Do
    DoEvents
    Loop Until Not WebBrowser1.Busy
    'loop till we have some stuff in strHTML
    Do
    DoEvents
    strHTML = WebBrowser1.Document.body.innerHTML
    Loop Until (Len(strHTML) > 400)
    
    '
    ' read in the text into string variable
    '
    strHTML = WebBrowser1.Document.body.innerHTML
    Text2.Text = strHTML
    '
    'text is not matching the window.
    '

    What I want to do is put in some ip addresses and "submit" and then extract the results from a string variable. I see in the screen the results but the variable does not match. Using VB6 and IE6

  30. #70
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: vb web browser tutorial

    The information that you inserted into a field on the page is only valid for that page. After you submit the Form you sit and wait for the returned responses which will be a new page. The information on one page doesn't mean it is going to be there on another page. Another problem you should recode to have your fields that you want to fill in be done in the _DocumentComplete event and not as the result of a loop being terminated by Loop Until Not WebBrowser1.Busy. I say this because the indicator .Busy can be triggered before the document has actually completed the process but in the _DocumentComplete event you are gauranteed that the process has completed.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  31. #71
    New Member
    Join Date
    Aug 2009
    Posts
    4

    Smile Search Bar!

    Hello VB Forums!
    Since this is a Internet Explorer based web browser, the code for the search bar was simple:

    All you need is :
    -1x Text Box
    -1x Button

    (and one, pre-existing URL bar)

    And the code:

    Code:
    Private Sub BUTTON_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BUTTON.Click
            WebBrowser1.Navigate("http://www.google.com.au/search?hl=en&source=hp&q=" + SEARCHBOX.Text + "&meta=&aq=null&oq=googl")
            URLBOX.Text = ("http://www.google.com.au/search?hl=en&source=hp&q=" + SEARCHBOX.Text + "&meta=&aq=null&oq=googl")
        End Sub
    That's it!
    Have Fun!

  32. #72
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: vb web browser tutorial

    First, your code is not for VB6.

    Second, that is still not the way to do it because you are using hard-coded string URL to be placed in the textbox


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  33. #73
    Member
    Join Date
    Nov 2008
    Posts
    35

    Re: vb web browser tutorial

    Quote Originally Posted by jmsrickland View Post
    The information that you inserted into a field on the page is only valid for that page. After you submit the Form you sit and wait for the returned responses which will be a new page. The information on one page doesn't mean it is going to be there on another page. Another problem you should recode to have your fields that you want to fill in be done in the _DocumentComplete event and not as the result of a loop being terminated by Loop Until Not WebBrowser1.Busy. I say this because the indicator .Busy can be triggered before the document has actually completed the process but in the _DocumentComplete event you are gauranteed that the process has completed.
    I dont understand- how do I use _DocumentComplete event?

    I have seen this code but don't really understand when its called, would you do a loop until Page_Loaded is True (obvoiusly you set it to False before calling)?-

    Code:
    Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If (pDisp Is WebBrowser1.object) Then
        Page_Loaded = True
        End If
    End Sub
    After I submit the form how would I retreive the data?

    And finally how do I block the popup that results from the submission of the form?

    EDIT-- I put a breakpoint into the part that read the data (breakpoint at strHTML = ***). My code works excpet that upon form submission you get a popup and my code reads the popup not the form that I submited. If I run this and close the popup manually when the breakpoint is hit I get the correct data. So I guess the critical thing in addition to correctly figuring out when the pages are done is to figure out how to prevent the popup or to close it before reading in the data. I have read the first page of this thread dealing with popups but it confuses my small brain! help!
    Last edited by John1in2; Sep 3rd, 2009 at 04:18 PM.

  34. #74
    New Member
    Join Date
    Sep 2009
    Posts
    2

    Re: vb web browser tutorial

    Hi All I am new to the broswer and the tutorial is great thanks! - Im using the VBA version which I assume is the same control as VB6. Just a quick issue - Im tying to create a versioning control software for Excel, that uses a web address to access an Excel file. Problem that I have is that when the webbrowser access a specified .xls document it opens the spreadsheet in the broswer itself not requesting the user to download the file. Im still new to the control and cant find how to force the control to download the file rather than just display it in the actual webbrowser, any help would be great!

  35. #75
    Member MSWindowsUser's Avatar
    Join Date
    Dec 2007
    Posts
    40

    Re: vb web browser tutorial

    @ MrDavidThorn: Welcome to the VBForums!

    New codes (attachments below)

    Fixes:
    Hyperlink in new window fixed
    Popup block fixed
    Back & Forward button enable fixed
    Status fixed

    Unfixed:
    None as of now :-D

    Enjoy my new project. Feel free to rename the objects/program name if desired, and to fix the version number, go to: Project > Project1 Properties...
    Make tab, type in a desired number (Integers only), click OK, save every form project, and the project, make an EXE, make an installation project from Start > Programs (All Programs for others) > Microsoft Visual Studio 6.0 > Microsoft Visual Studio 6.0 Tools > Package & Deployment Wizard

    Follow the instructions, burn the files to a CD, install the program on other machines.

    Next project might contain the Full Screen option & Windows Updates (Windows 95 & Higher only)

    edit: to go onto the last visited site, remove the "Visited: Username@" line from the Text box, and click Go, but select the "Visited History" from the drop-down menu, click Get Cache, and select the site that you visited last.
    Attached Files Attached Files
    Last edited by MSWindowsUser; Sep 5th, 2009 at 11:28 PM. Reason: Notes for other users :D

  36. #76
    New Member
    Join Date
    Jul 2009
    Posts
    15

    Re: vb web browser tutorial

    Thanks for the cool tutorial I am learning a lot form it to make my own little browser thanks agian. keep up the good work

  37. #77
    New Member
    Join Date
    Oct 2009
    Posts
    1

    Re: vb web browser tutorial

    Hy guys I had a problem with that code in webbrowser tutorial

    I need use a webbrowser with one single window. Then I used the example

    "Open in new window
    VB Code:
    'This to open a new window with our browser.Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)Dim frm As Form1Set frm = New Form1Set ppDisp = frm.WebBrowser1.Objectfrm.ShowEnd Sub "


    However if i click on link that open in other window the browser show a blank page. It cant open any link with new page


    Can someone help me?

  38. #78
    New Member
    Join Date
    Oct 2009
    Posts
    1

    Re: vb web browser tutorial

    I am a bit confused on the progress bar,
    When it says: If progress = -1 then progressbar1.value =...

    What is Progress refering to?

  39. #79
    New Member
    Join Date
    Oct 2009
    Posts
    1

    Re: vb web browser tutorial

    Very useful. Thank all.

  40. #80
    Member yacky's Avatar
    Join Date
    Nov 2009
    Posts
    38

    Re: vb web browser tutorial

    Hi,

    how can I make Tabs in this web browser??

Page 2 of 3 FirstFirst 123 LastLast

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