Page 4 of 4 FirstFirst 1234
Results 121 to 135 of 135

Thread: Webbrowser Control Tip and Examples

  1. #121
    Member
    Join Date
    Dec 2008
    Posts
    58

    Re: Webbrowser Control Tip and Examples

    I am posting html data with web form.. and i check my web page.. i dont see the iframe codes.. why wb component replacing iframe codes?

  2. #122
    New Member
    Join Date
    Sep 2014
    Posts
    1

    Angry Re: Webbrowser Control Tip and Examples

    Is there any way to changing WebBrowser Document Location without navigating?

    Actually i want to make a browsing control with socket connection, Because i have many Forms Data to submit directly through links.

    I use to navigate about:blank on form_load event. But the images are not showing because of browser location is "about:blank"

    I need to change it to my specific location. I've tried by adding base url in <head> tag when the source is loading but that didn't work.

  3. #123
    New Member
    Join Date
    Nov 2014
    Posts
    5

    Re: Webbrowser Control Tip and Examples

    Hello. Im using VB.net. I need a way of getting the awebsite favicon. Can you help?

  4. #124
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Webbrowser Control Tip and Examples

    I would suggest posting your query to the NET section of the forum.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  5. #125
    New Member
    Join Date
    Mar 2015
    Posts
    1

    Re: Webbrowser Control Tip and Examples

    I have a question, maybe this is the wrong thread...

    I have a little "Windows Form1" and it has very basic WebBrowser made with Studio Community 2013. WebBrowser is fills the whole Form1. If I give it a static url in WebBrowser properties, it navigates to that address no problem. Is is possible to make it navigate something like variable that is given when calling this Form1.exe from CMD example?

    My idea is that normally when you call that exe it will open the window and navigate to www.google.fi for example. But if I call it for exampl "Form1.exe www.bing.com" or "Form1.exe -p1www.bing.com" or something like that, it would open the window and navigate to www.bing.com.

    This should be possible but how? I'm new using Studio and at has been a while when I coded these applicatios...

    Thanks!

  6. #126
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: Webbrowser Control Tip and Examples

    Then you are using VB.NET, this section is dedicated to VB6 and older.
    So ask your question in a new thread in the correct forum.

  7. #127
    Member
    Join Date
    Dec 2014
    Posts
    57

    Red face Re: how to Pick a text from Table in a page

    Animated Browser Complete:

    2 images: 1 The animation Gif. 2 The Still Image. I use these Name:  ldng.gif
Views: 2402
Size:  4.7 KBName:  cmplt.png
Views: 2436
Size:  4.2 KB

    Set the visible property to False and stage them one on top of the other around the URL textbox.

    I named the PictureBox of each to "Complete" for the still image, and "Loading" for the animated gif.

    Then Under document complete I have this code.

    Code:
        Private Sub WebBrowser1_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
            Loading.Visible = False
            Complete.Visible = True
        End Sub
    Then when ever I navigate, go forward, go back, refresh I have this code.

    Code:
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            'This is the GO button.
            WebBrowser1.Navigate(TextBoxURL.Text)
            Loading.Visible = True
            Complete.Visible = False
        End Sub
    
        Private Sub Button13_Click(sender As System.Object, e As System.EventArgs) Handles Button13.Click
            'This is the FORWARD button
            WebBrowser1.GoForward()
            Loading.Visible = True
            Complete.Visible = False
        End Sub
    
        Private Sub Button12_Click(sender As System.Object, e As System.EventArgs) Handles Button12.Click
            'This is the BACK button
            WebBrowser1.GoBack()
            Loading.Visible = True
            Complete.Visible = False
        End Sub
    
        Private Sub Button11_Click(sender As System.Object, e As System.EventArgs) Handles Button11.Click
            'This is the REFRESH button
            WebBrowser1.Refresh()
            Loading.Visible = True
            Complete.Visible = False
        End Sub
    Now you have animated your navigation and can stop wondering if your click on the button took or not.

    Disclaimer: Though this code is in VB2010, I am sure the same principle can be used in older compilers.
    Last edited by teamster; Jul 11th, 2015 at 08:29 AM. Reason: added disclaimer

  8. #128
    Hyperactive Member
    Join Date
    Aug 2011
    Location
    Palm Coast, FL
    Posts
    416

    Re: Webbrowser Control Tip and Examples

    I'm using the browser control to display html code I generate myself. I want to display a link which doesn't actually navigate anywhere (the link is not for navigation, it's to trigger an action.) and I want to know when the user clicks on the link. How is this achieved?

    two questions:

    1. how do I create a hyperlink like this - e.g. Click here to do such and such...
    2. Is an event raised somewhere when the link is clicked on by the user? I don't want the browser to automatically navigate anywhere when the user clicks on the link. I want to take some other action in my app when the user clicks on the link.

    TIA,
    Art

  9. #129
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: Webbrowser Control Tip and Examples

    you should post in a new thread.
    There's many ways - but the most obvious is something like this.


    Code:
    <div id='DoSomething' style='text-decoration: underline; cursor:pointer;'>A Link!</div>
    Code:
    Private WithEvents MyDiv As HTMLDivElement
    
    Private Function MyDiv_onclick() As Boolean
        MsgBox "Div Clicked!"
    End Function
    
    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
        Set MyDiv = WebBrowser1.Document.getElementById("DoSomething")
    End Sub

  10. #130
    Hyperactive Member
    Join Date
    Aug 2011
    Location
    Palm Coast, FL
    Posts
    416

    Re: Webbrowser Control Tip and Examples

    Quote Originally Posted by DEXWERX View Post
    you should post in a new thread.
    There's many ways - but the most obvious is something like this.
    Thanks Dex, very helpful of you!

    As a follow question to your suggested solution. The Div always appears as a new line. Is there a way to have it stay on the current line and not start a new line?
    Last edited by AAraya; Jan 13th, 2017 at 11:45 AM.

  11. #131
    Hyperactive Member
    Join Date
    Aug 2011
    Location
    Palm Coast, FL
    Posts
    416

    Re: Webbrowser Control Tip and Examples

    I spent days searching this one out so it may be of help to someone else.

    Change the border style from 3d to flat:

    Code:
    Private Sub WebBrowser_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
        WebBrowser.Document.Body.style.border = "none"
    End Sub
    Last edited by AAraya; Jan 13th, 2017 at 11:18 AM.

  12. #132
    Hyperactive Member
    Join Date
    Aug 2011
    Location
    Palm Coast, FL
    Posts
    416

    Re: Webbrowser Control Tip and Examples

    The Custom Right Click Menu code also seems to work as an alternate way to disable the context menu without requiring subclassing or use of a helper DLL like your earlier solution outlines. Simply use the custom right click menu code you have but omit the line which shows a custom popup menu.

    Code:
    'Must Add Microsoft HTML Object Library
    Option Explicit
        Public WithEvents HTML As HTMLDocument
     
    Private Function HTML_oncontextmenu() As Boolean
       HTML_oncontextmenu = False
    End Function
     
    Private Sub Form_Load()
        WebBrowser1.Navigate "www.google.com"
    End Sub
     
    Private Sub Form_Unload(Cancel As Integer)
       Set HTML = Nothing
    End Sub
    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, _
                                                     URL As Variant)
       Set HTML = WebBrowser1.Document
    End Sub

  13. #133
    New Member
    Join Date
    Apr 2013
    Posts
    7

    Re: Webbrowser Control Tip and Examples

    Does anyone know what the extra arguments do when using navigate?

  14. #134
    New Member
    Join Date
    Nov 2016
    Posts
    1

    Re: Webbrowser Control Tip and Examples

    Loading HTML content into a WebBrowser control from memory

    Works with SVG+XML loading.

    References :
    • "Loading HTML content into a WebBrowser control from memory", Scott Waletzko (sp!ke), link
    • "Loading HTML content from a Stream", MSDN, link
    • "[VB6] Modern Shell Interface Type Library - oleexp.tlb - VBForums", fafalone, link



    On VB6 IDE, add the following references :
    • Microsoft HTML Object Library
    • OLEXP - olelib With Modern Interfaces by fafalone, v4.x

    and of course Microsoft Internet Controls component.

    Code:
    Private Declare Function CreateStreamOnHGlobal Lib "ole32.dll" (ByRef hGlobal as Any, ByVal fDeleteOnResume as long, ByRef ppstr As Any) As Long
    
    Public Sub loadContent(ByRef wb As SHDocVwCtl.WebBrowser, ByRef htmlDoc as MSHTML.HTMLDocument, ByRef aContents() as Byte)
    Dim oPersistStreamInit as IPersistStreamInit
    Dim oStream as IStream
    
    ' ensure the document is loaded wb.Navigate2 "about:blank" While wb.ReadyState <> SHDocVwCtl.tagREADYSTATE.READYSTATE_COMPLETE
    DoEvents
    Wend ' get a reference to the document Set htmlDoc = wb.Document ' initialize the document using the IPersistStreamInit Set oPersistStreamInit = htmlDoc oPersistStreamInit.InitNew ' set the content into a stream If Not CreateStreamOnHGlobal (aContents(0), True, oStream) Then
    ' load the content into browser oPersistStreamInit.Load oStream
    End If Set oStream = Nothing Set oPersistStreamInit = Nothing
    End Sub

  15. #135
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,580

    Re: how to Pick a text from Table in a page


Page 4 of 4 FirstFirst 1234

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