vb web browser tutorial-VBForums
Page 1 of 3 123 LastLast
Results 1 to 40 of 108

Thread: vb web browser tutorial

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Post vb web browser tutorial

    UPDATED ON 18/6/2006

    In this thread i'm going to talk about all the things that you might need in building an internet web browser using visualbasic component.

    1- Adding components:

    Go to "Project" on the top menu, and choose "Components" or click CTRL-T, then check "Microsoft html object library" and "Microsoft internet controls" and "Microsoft Windows common Controls 5.0".

    You will see that new objects are appearing in the left box of your menu, now choose the webbrowser icon which looks like an earth and add it to your form, and make its size as you want, (its name is WebBrowser1 in this tutorial)

    Also click on the "Progress bar" component and add it to your form.

    2- Adding buttons and objects:

    Now add the "6" essential command buttons to your form, and name them as the following: "Back","Forward","Stop","Refresh","Home" and "GO", Now add 1 combo box which the user will enter the web address on it.

    3- Coding your application:

    First click on the "GO" button and write this code inside it:
    VB Code:
    1. WebBrowser1.Navigate Combo1

    Now We will code the other buttons as the following:

    Back button:

    VB Code:
    1. On Error Resume Next
    2. WebBrowser1.GoBack

    Forward button:
    VB Code:
    1. On Error Resume Next
    2. WebBrowser1.GoForward

    Stop button:
    VB Code:
    1. On Error Resume Next
    2. WebBrowser1.Stop

    Refresh button:
    VB Code:
    1. WebBrowser1.Refresh

    Home button:
    VB Code:
    1. WebBrowser1.GoHome

    NOW YOU CAN TRY USING YOUR NEW WEB BROWSER.

    4- Advanced codes:

    You can add the following codes to your application to make it work better, Just place these codes anywhere in your coding window.

    * Add a progress bar

    VB Code:
    1. 'This to make the progress bar work and to show a status message, and an image.
    2. Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
    3. On Error Resume Next
    4.     If Progress = -1 Then ProgressBar1.Value = 100 'the name of the progress bar is "ProgressBar1".
    5.         Label1.Caption = "Done"
    6.         ProgressBar1.Visible = False 'This makes the progress bar disappear after the page is loaded.
    7.         Image1.Visible = True
    8.     If Progress > 0 And ProgressMax > 0 Then
    9.         ProgressBar1.Visible = True
    10.         Image1.Visible = False
    11.         ProgressBar1.Value = Progress * 100 / ProgressMax
    12.         Label1.Caption = Int(Progress * 100 / ProgressMax) & "%"
    13.     End If
    14.     Exit Sub
    15. End Sub

    But here you will need to add an label which is called "Label1" and also an small image such as a smile or earth or anything you want and the name is "image1"

    * Open in new window

    VB Code:
    1. 'This to open a new window with our browser.
    2. Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    3. Dim frm As Form1
    4. Set frm = New Form1
    5. Set ppDisp = frm.WebBrowser1.Object
    6. frm.Show
    7. End Sub

    This to open the new window with your browser.


    * History and current visited site.

    VB Code:
    1. 'This keeps the visited sites history and also changes the title of the browser as the page title.
    2. Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    3.     On Error Resume Next
    4.     Dim i As Integer
    5.     Dim bFound As Boolean
    6.     Me.Caption = WebBrowser1.LocationName
    7.     For i = 0 To Combo1.ListCount - 1
    8.         If Combo1.List(i) = WebBrowser1.LocationURL Then
    9.             bFound = True
    10.             Exit For
    11.         End If
    12.     Next i
    13.     mbDontNavigateNow = True
    14.     If bFound Then
    15.         Combo1.RemoveItem i
    16.     End If
    17.     Combo1.AddItem WebBrowser1.LocationURL, 0
    18.     Combo1.ListIndex = 0
    19.     mbDontNavigateNow = False
    20. End Sub


    5- More coding:

    You can add more buttons to your browser as those:

    * Find if a word is in the page (taken from a tutorial on this forum).

    VB Code:
    1. 'This to tell you if a word is in the page, Here we call the WebPageContains function.
    2. Private Sub Command7_Click()
    3.     Dim strfindword As String
    4.         strfindword = InputBox("What are you looking for?", "Find", "") ' what word to find?
    5.             If WebPageContains(strfindword) = True Then 'check if the word is in page
    6.                 MsgBox "The webpage contains the text" 'string is in page
    7.             Else
    8.                 MsgBox "The webpage doesn't contains the text" 'string is not in page
    9.             End If
    10. End Sub
    11.  
    12. 'This is the finding function.
    13. Private Function WebPageContains(ByVal s As String) As Boolean
    14.     Dim i As Long, EHTML
    15.     For i = 1 To WebBrowser1.Document.All.length
    16.         Set EHTML = _
    17.         WebBrowser1.Document.All.Item(i)
    18.  
    19.  
    20.         If Not (EHTML Is Nothing) Then
    21.             If InStr(1, EHTML.innerHTML, _
    22.             s, vbTextCompare) > 0 Then
    23.             WebPageContains = True
    24.             Exit Function
    25.         End If
    26.     End If
    27. Next i
    28. End Function

    * Page properties
    VB Code:
    1. WebBrowser1.ExecWB OLECMDID_PROPERTIES, OLECMDEXECOPT_DODEFAULT
    This will run the page properties.

    * Print a page
    VB Code:
    1. WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT

    * Save a page
    VB Code:
    1. WebBrowser1.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DODEFAULT

    * Delete cookies from your computer

    VB Code:
    1. 'This code is used to empty the cookies from the user's computer / We call function from here.
    2. Private Declare Function GetUserName _
    3. Lib "advapi32.dll" Alias "GetUserNameW" ( _
    4. ByVal lpBuffer As Long, _
    5. ByRef nSize As Long) As Long
    6.  
    7. Private Declare Function SHGetSpecialFolderPath _
    8. Lib "shell32.dll" Alias "SHGetSpecialFolderPathA" ( _
    9. ByVal hwnd As Long, _
    10. ByVal pszPath As String, _
    11. ByVal csidl As Long, _
    12. ByVal fCreate As Long) As Long
    13.  
    14. Private Const CSIDL_COOKIES As Long = &H21
    15.  
    16. 'This calls the function that deletes the cookies.
    17. Public Sub Command1_Click()
    18. Dim sPath As String
    19. sPath = Space(260)
    20. Call SHGetSpecialFolderPath(0, sPath, CSIDL_COOKIES, False)
    21. sPath = Left$(sPath, InStr(sPath, vbNullChar) - 1) & "\*.txt*"
    22. On Error Resume Next
    23. Kill sPath
    24.  
    25. End Sub


    * Show webpage's source code:

    VB Code:
    1. Private Sub Form_Load()
    2. Text1.Text = Form1.browser.Document.documentElement.innerHTML
    3. End Sub


    6- Important codes: New!


    * Popups Blocker

    VB Code:
    1. Private Function IsPopupWindow() As Boolean
    2. On Error Resume Next
    3. If WebBrowser1.Document.activeElement.tagName = "BODY" Or WebBrowser1.Document.activeElement.tagName = "IFRAME" Then
    4. IsPopupWindow = True
    5. Else
    6. IsPopupWindow = False
    7. End If
    8. End Function
    9.  
    10. Private Sub webbrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    11. Dim frm As Form1
    12. Cancel = IsPopupWindow
    13. If Cancel = False Then
    14. Set frm = New Form1
    15. Set ppDisp = frm.WebBrowser1.object
    16. frm.Show
    17. End If
    18. End Sub

    This will block all the popups, but in the same time it will open links in a new window as usual.


    * JavaScripts handeling

    VB Code:
    1. WebBrowser1.Silent = True

    This will not show any errors from pages while you are using your web browser, put it in the form load event.

    * The size of the browser and the scrollbars code

    VB Code:
    1. Private Sub Form_Resize()
    2. On Error Resume Next
    3. WebBrowser1.Width = Me.ScaleWidth
    4. WebBrowser1.Height = Me.ScaleHeight - 1680
    5. End Sub

    This code will make your webbrowser fit with the overall form structure, and also will make the scrollbars compitable with the form.


    Now you got a great web browser with many functions

    Need icons for your application? just do a fast forum search and you will find a great sites for icons or images.
    Attached Images Attached Images  
    Last edited by zeidhaddadin; Jun 17th, 2006 at 05:14 PM.

  2. #2
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: vb web browser tutorial

    Nice tutorial

    A real challenge would be making a browser without the 'Microsoft internet controls'

  3. #3
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,360

    Re: vb web browser tutorial

    This should be moved to FAQ or something since it is not a question...


    But there is a lot more that can be added to this:

    example:

    using commandstatechange event u can enable/disable the back/forward buttons


    VB Code:
    1. Private Sub Webbrowser1_CommandStateChange(ByVal Command As Long, ByVal Enable As Boolean)
    2.     On Error Resume Next
    3.     DoEvents: DoEvents: DoEvents
    4.     If Enable = True And Command = CSC_NAVIGATEBACK Then
    5.         cmdBack.Enabled = True
    6.     ElseIf Enable = False And Command = CSC_NAVIGATEBACK Then
    7.         cmdBack.Enabled = False
    8.     End If
    9.     If Enable = True And Command = CSC_NAVIGATEFORWARD Then
    10.         cmdForward.Enabled = True
    11.     ElseIf Enable = False And Command = CSC_NAVIGATEFORWARD Then
    12.         cmdForward.Enabled = False
    13.     End If
    14. End  Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,334

    Re: vb web browser tutorial

    Moved to the CodeBank.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Re: vb web browser tutorial

    thanks for sharing, btw the text box which you can see in the screenshot if for writing notes while surfing or viewing pages, me personaly i need this thing in my browser

  6. #6
    Member
    Join Date
    Jun 2006
    Posts
    35

    Re: vb web browser tutorial

    how can i get it to scale to become a full page browser not just a little one?

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: vb web browser tutorial

    Static:
    VB Code:
    1. Private Sub Webbrowser1_CommandStateChange(ByVal Command As Long, ByVal Enable As Boolean)
    2.     If Command = CSC_NAVIGATEBACK Then
    3.       cmdBack.Enabled = Enable
    4.     Else If Command = CSC_NAVIGATEFORWARD Then
    5.       cmdForward.Enabled = Enable
    6.     End If
    7. End  Sub
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Re: vb web browser tutorial

    Quote Originally Posted by KPS.
    how can i get it to scale to become a full page browser not just a little one?
    I didn't understand what exactly you mean, but this is a code to make the web page fit with the form and also the scrollbars.

    VB Code:
    1. 'This to make the scrollbar fit with form size.
    2. Private Sub Form_Resize()
    3. WebBrowser1.Width = Me.ScaleWidth
    4. End Sub

  9. #9
    New Member
    Join Date
    Jul 2006
    Posts
    2

    Re: vb web browser tutorial

    For some reason when i try to go to a website i get an 'Action Canceled' error. Can anyone help me with this?

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Re: vb web browser tutorial

    Use "On Error Resume Next".

  11. #11
    New Member
    Join Date
    Jul 2006
    Posts
    2

    Re: vb web browser tutorial

    I'm using that already. I'm using the same code used in the tutorial and am still having trouble with Page cannot be displayed errors and such.

  12. #12
    Junior Member
    Join Date
    Jan 2007
    Location
    england
    Posts
    27

    Re: vb web browser tutorial

    this is a very good tutorial, it has helped me alot with a college assignment. and before anything is sed i didnt copy it so i cannot be failed lol i just read the code understood it in my mind and put it down on my program. anyway this was a very good example and i have learnd alot from it and developed on it. so THANKS!!!!
    dont believe in all that you've been told!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  13. #13
    Hyperactive Member rjbudz's Avatar
    Join Date
    Jul 2005
    Location
    San Diego
    Posts
    262

    Re: vb web browser tutorial

    Use of the 'Microsoft internet controls' does hamper the functionality of this somewhat, though I agree, this is a really good tutorial.

    Do you know of a way to prevent the WebBrowser control from reading from and writing to the same history as Internet Explorer? This drawback (and probably others) relegates the control to the status of Internet Explorer Jr., rather than its own app.

  14. #14
    New Member
    Join Date
    Feb 2007
    Location
    Your soul...
    Posts
    1

    Re: vb web browser tutorial

    I just wanted to say this is a great tutorial. I'm using this for a school assignment and I think I'll get a pretty good grade on it.
    Kenshin: (to Megumi) Even if you were to die, it won't bring anyone else back. Instead of hurting yourself, helping other people is the best way to make up for your mistakes. Batusai, the slasher is still alive and that's what he does.

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Re: vb web browser tutorial

    You are all welcomed

  16. #16
    Addicted Member
    Join Date
    Sep 2000
    Location
    Atlanta, GA
    Posts
    177

    Re: vb web browser tutorial

    This is a great tutorial. How can you get the popup window to resize and/or close based on the webpage(s)'s original javascript code? Your code opens the popup window but does not close it. Thx
    212 will lead you to the truth

  17. #17
    Junior Member
    Join Date
    Jun 2007
    Posts
    20

    Re: vb web browser tutorial

    Wow, great tutorial. But I was just wondering one thing. I use tabs in my web browser but I had to set the amount of tabs and its content before I created the project. Is there a code to make any links clicked on a web page go straight to a new tab instead of opening IE up. And an option to create a new tab

    Thanks

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

    Smile Re: vb web browser tutorial

    Quote Originally Posted by samaster1991
    Wow, great tutorial. But I was just wondering one thing. I use tabs in my web browser but I had to set the amount of tabs and its content before I created the project. Is there a code to make any links clicked on a web page go straight to a new tab instead of opening IE up. And an option to create a new tab

    Thanks
    Here's a code sample
    Code:
    Private Sub TabStrip1_CLick()
    
    Select Case TabStrip1.SelectedItem.Key
    
    Case "Home Page"
    
    WebBrowser1.GoHome
    
    Case "New Tab"
    
    Combo1.Text = "about:blank"
    WebBrowser.Navigate (Combo1.Text)
    End Select
    
    End Sub
    You can add more cases to your Tabs.

    Merry Christmas,

    MSWindowsUser
    Visual Basic User and Advanced coder.

  19. #19
    Junior Member
    Join Date
    Jun 2007
    Posts
    20

    Re: vb web browser tutorial

    Thanks

    Merry Christmas

  20. #20
    Junior Member
    Join Date
    Dec 2007
    Location
    Kathmandu, Nepal
    Posts
    23

    Re: vb web browser tutorial

    Dear sir,
    Please help me.
    This is a great tutorial. How can you get the popup window close based on the webpage(s)'s original javascript code? In this code opens the popup window but does not close it. After submitting value to main window how to close popup window ?

    Raghu Bhandari

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

    Re: vb web browser tutorial

    Quote Originally Posted by raghu_ktm@yahoo.com
    Dear sir,
    Please help me.
    This is a great tutorial. How can you get the popup window close based on the webpage(s)'s original javascript code? In this code opens the popup window but does not close it. After submitting value to main window how to close popup window ?

    Raghu Bhandari
    Open menu editor (Ctrl + E), type in &Pop-ups in the Caption box, mnuPopups in the Name box, hit enter, add &Allow in the caption box, mnuAllow in the name box, check checked, hit the right arrow so that it can go into the pop-ups menu, add &Disallow in the Caption box, mnuDisallow in the name box, click on the right arrow to let it stay in the Pop-ups menu.

    Code:
    Private Sub mnuAllow_Click()
        mnuAllow.Checked = True
        mnuDisallow.Checked = False
        Dim frmNW As frmInternet
        Dim ppDisp As Object
        Dim Cancel As Boolean
        
        Set frmNW = New frmInternet
        frmNW.brwWebBrowser.RegisterAsBrowser = True
        Set ppDisp = frmNW.brwWebBrowser.object
        frmNW.Show
    End Sub
    
    Private Sub mnuDisallow_Click()
        mnuDisallow.Checked = True
        mnuAllow.Checked = False
        Dim ppDisp As Object
        Dim Cancel As Boolean
        Dim frmNW As frmInternet
    
        Cancel = IsPopupWindow
        
        If Cancel = False Then
            Set frmNW = New frmInternet
            Set ppDisp = frmNW.brwWebBrowser.object
            frmNW.Visible = True And False
        End If
    End Sub
    
    Private Sub brwWebBrowser_NewWindow2(ppDisp As Object, Cancel As Boolean)
        On Error Resume Next
        Dim frmNW As frmInternet
        
        Cancel = IsPopupWindow
        
        If mnuDisallow.Checked = False Then
            mnuAllow.Checked = True
            Set frmNW = New frmInternet
            frmNW.brwWebBrowser.RegisterAsBrowser = True
            Set ppDisp = frmNW.brwWebBrowser.object
            frmNW.Show
        ElseIf mnuAllow.Checked = False Then
            mnuDisallow.Checked = True
            Cancel = False
            Set frmNW = New frmInternet
            Set ppDisp = frmNW.brwWebBrowser.object
            frmNW.Visible = True And False
        End If
    End Sub
    
    Private Function IsPopupWindow() As Boolean
        On Error Resume Next
        If brwWebBrowser.Document.activeElement.tagName = "BODY" Or brwWebBrowser.Document.activeElement.tagName = "IFRAME" Then
            IsPopupWindow = True
        Else
            IsPopupWindow = False
        End If
    End Function
    Code sample above can be copied.

    To disallow, go to Pop-ups > Click on Disallow and it will check the disallow menu. ***NOTE: This cannot open links in a new window. It will block the new window from opening. ***

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

    Re: vb web browser tutorial

    Code:
    Private Function Popups() as Boolean
        Dim frmAds as Form1
        Dim ppDisp as Object
        Dim Cancel AS Boolean
    
        Set frmAds = New Form1
        Set ppDisp = Form1.WebBrowser1.Object
    
        If Popups = False Then
            Cancel = False
            frmAds.Visible = True And Fasle
            Unload frmAds
        End If
    End Function
    
    Private Sub WebBrowser1_NewWindow2(ppDisp as Object, Cancel As Boolean)
        Dim frmNewWindow As Form1
    
        Set frmNewWindow = New Form1
        Set ppDisp = Form1.WebBrowser1.Object
        WebBrowser1.RegisterAsBrowser = True
        frmNewWindow.Show
        Popups = False
    End Sub
    This block all pop-ups* and you can still open links in a new window.

    *Do NOT go on websites that the domains expired. If you go to another website, only ONE pop-up show up, close the pop-up.
    Last edited by MSWindowsUser; Dec 30th, 2007 at 02:01 AM.

  23. #23
    Junior Member
    Join Date
    Dec 2007
    Location
    Kathmandu, Nepal
    Posts
    23

    Re: vb web browser tutorial

    Dear sir,
    I try like this to close my window.
    but i got unspecified error and my application close.

    Private Sub wbrBrowser_WindowClosing(ByVal IsChildWindow As Boolean, Cancel As Boolean)
    'On Error Resume Next
    If (IsChildWindow) Then
    Cancel = True
    Unload Me (Error On this line)
    Else
    Cancel = False
    End If
    End Sub

    Private Function IsPopupWindow() As Boolean
    On Error Resume Next
    If WebBrowser1.Document.activeElement.tagName = "BODY" Or WebBrowser1.Document.activeElement.tagName = "IFRAME" Then
    IsPopupWindow = True
    Else
    IsPopupWindow = False
    End If
    End Function

    Sir What i did mistake in code can u help me ?

    Thanks
    Raghu Bhandari

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

    Re: vb web browser tutorial

    Quote Originally Posted by raghu_ktm@yahoo.com
    Dear sir,
    I try like this to close my window.
    but i got unspecified error and my application close.

    Private Sub wbrBrowser_WindowClosing(ByVal IsChildWindow As Boolean, Cancel As Boolean)
    'On Error Resume Next
    If (IsChildWindow) Then
    Cancel = True
    Unload Me (Error On this line)
    Else
    Cancel = False
    End If
    End Sub

    Private Function IsPopupWindow() As Boolean
    On Error Resume Next
    If WebBrowser1.Document.activeElement.tagName = "BODY" Or WebBrowser1.Document.activeElement.tagName = "IFRAME" Then
    IsPopupWindow = True
    Else
    IsPopupWindow = False
    End If
    End Function

    Sir What i did mistake in code can u help me ?

    Thanks
    Raghu Bhandari
    Remove the single quote from the On Error Resume Next line.

  25. #25
    Junior Member
    Join Date
    Dec 2007
    Location
    Kathmandu, Nepal
    Posts
    23

    Re: vb web browser tutorial

    Dear sir,
    No no mistakenly i paste that wrong code but i already try without single quote. when my program execute this line VB application also close with unspecified error. Any Idea ?

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

    Re: vb web browser tutorial

    Quote Originally Posted by raghu_ktm@yahoo.com
    Dear sir,
    No no mistakenly i paste that wrong code but i already try without single quote. when my program execute this line VB application also close with unspecified error. Any Idea ?
    If you are using Visual Basic 2005 then
    Me.Close()
    ElseIf you are using Visual Basic 6 Then
    Unload Me
    End If

  27. #27
    Junior Member
    Join Date
    Dec 2007
    Location
    Kathmandu, Nepal
    Posts
    23

    Re: vb web browser tutorial

    NO Sir
    Because of JavaScript i am getting error

    Code:
    Private Sub wbrBrowser_WindowClosing(ByVal IsChildWindow As Boolean, Cancel As Boolean)
    On Error Resume Next
    If (IsChildWindow) Then
       Cancel = True
       Unload Me (Error On this line)
    Else
       Cancel = False
    End If
    End Sub
    Some page can close but some pages catch error on this line
    So what can i do ?

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

    Re: vb web browser tutorial

    Quote Originally Posted by raghu_ktm@yahoo.com
    NO Sir
    Because of JavaScript i am getting error

    Code:
    Private Sub wbrBrowser_WindowClosing(ByVal IsChildWindow As Boolean, Cancel As Boolean)
    On Error Resume Next
    If (IsChildWindow) Then
       Cancel = True
       Unload Me (Error On this line)
    Else
       Cancel = False
    End If
    End Sub
    Some page can close but some pages catch error on this line
    So what can i do ?
    Remove the parentheces on "If (IsChildWindow) Then"
    Add = True Or False after IsChildWindow. Solved?

  29. #29
    New Member Visual Master's Avatar
    Join Date
    Oct 2007
    Location
    The Hague,Netherlands
    Posts
    15

    Re: vb web browser tutorial

    does someone know a code like when i press Enter it will load,just like "real" browsers?

  30. #30
    New Member Visual Master's Avatar
    Join Date
    Oct 2007
    Location
    The Hague,Netherlands
    Posts
    15

    Lightbulb Re: vb web browser tutorial

    Quote Originally Posted by dalto11
    I'm running on 2008 so I don't know if this is the same for you...
    No,i'm using vb6 now but maybe i'll get 2008

  31. #31
    New Member Visual Master's Avatar
    Join Date
    Oct 2007
    Location
    The Hague,Netherlands
    Posts
    15

    Lightbulb Re: vb web browser tutorial - Search function

    First,make a commandbutton and a textbox.
    now double click on the command button and write this code:
    vb Code:
    1. Private Sub Command6_Click()
    2. WebBrowser1.Navigate "http://www.google.com/search?hl=en&q=" & Text2.Text & "&btnG=Google+Search"
    3. 'change "WebBrowser" to the name of your own browser.
    4. Form1.Caption = "WebBrowser - Search Results"
    5. End Sub
    Now,your browser has a search function!

  32. #32
    New Member
    Join Date
    Jan 2008
    Posts
    3

    Re: vb web browser tutorial

    where can i get a downlaodable version of this project??? urgent...

  33. #33

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Re: vb web browser tutorial

    Quote Originally Posted by nelton
    where can i get a downlaodable version of this project??? urgent...
    sorry but i don't have it .. i made it a while ago!

  34. #34
    New Member
    Join Date
    Jan 2008
    Posts
    3

    Re: vb web browser tutorial

    plz cud sum1 make it for me.....i tried doing it on my own but i got many errors....still learning VB

  35. #35
    New Member
    Join Date
    Jan 2008
    Posts
    3

    Re: vb web browser tutorial

    also im using VB6.0....whenever i try 2 load d 'microsoft internet controls' comp it gives an error saying c:\windows\system32\ieframe.dll\1 cud not b loaded...what can b d prob

  36. #36
    New Member
    Join Date
    Jan 2008
    Posts
    1

    help needed:vb web browser tutorial

    Hey Friends thanx a lot!! d tutorial was very helpful!!

    is there possibility to open a vb form in a IE xplorer???

    as per my project i want 2 navigate inside a vb form just like the way we navigate using frames in html.....i mean wen i click on a command button or link i want d other form 2 load within d parent form..is it possible??

    thanx a lott in advance.. ..My final yr project pendin coz of ds



    Regards...

  37. #37
    New Member Visual Master's Avatar
    Join Date
    Oct 2007
    Location
    The Hague,Netherlands
    Posts
    15

    Re: vb web browser tutorial

    also im using VB6.0....whenever i try 2 load d 'microsoft internet controls' comp it gives an error saying c:\windows\system32\ieframe.dll\1 cud not b loaded...what can b d prob
    Hi,i asked that question also, see http://www.vbforums.com/showthread.php?t=492583

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

    Thumbs up Re: vb web browser tutorial

    Quote Originally Posted by nelton
    where can i get a downlaodable version of this project??? urgent...
    Do you have VB6 on your PC? If so, download mine.

    Blocks Pop-ups and you can still open links in a new window.
    Attached Files Attached Files

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

    Re: vb web browser tutorial

    Quote Originally Posted by nelton
    also im using VB6.0....whenever i try 2 load d 'microsoft internet controls' comp it gives an error saying c:\windows\system32\ieframe.dll\1 cud not b loaded...what can b d prob
    Download my attachment, unzip the contents, copy the file to C:\WINDOWS\System, hit Ctrl + T, click Browse..., Go up one, double-click on the System Folder, for the file type, choose All Files (*.*) and type in shdocvw.DLL This works 100%

    The Only reason this doesn't open in Windows XP, it's because this file is not supported on VB6 with Windows XP on your PC.
    Attached Files Attached Files

  40. #40
    Member
    Join Date
    Feb 2008
    Posts
    37

    Re: vb web browser tutorial

    First off...good tutorial this. good work!

    Next up ... the problems folks had, I believe relates to the version of IE you have. When I updated mine from 7 to 8 (I think, version may be wrong but in any case, from one older version to the newest), this screwed my old VB6 IE Browser control.....

    Sorry if thats whats been posted above!

Page 1 of 3 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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.