VB 2005 (In Visual Studio 2005) WebBrowser Control - Question

Hello

Ive made a application which features a embedded WebBrowser Control in the form. In the properties box where it states url i dont wish to add a website url as my application runs within the program files directory. Now if i point the link to a html file located in the prog files directory it works fine without any trouble.

Id like to know if there is a way to just add the link in the properties box as "start.html" is this possible or do i have to keep using that horrible long link to the program file.

Any comments would be appreciated.

Thankyou

Anthony.




Answer this question

VB 2005 (In Visual Studio 2005) WebBrowser Control - Question

  • Amarender gade

    Hi Anthony,

    I believe you should not use an absolute path in the Url property of the web browser control since this path may change depending on where your program is installed.

    You can set the Url in your form's load event, for example

    Private Sub Form1_Load( _
    ByVal sender As System.Object, ByVal e As
    System.EventArgs) _
    Handles MyBase
    .Load

    Me.WebBrowser1.Url = New System.Uri( _
    System.IO.Path.Combine(System.Environment.CurrentDirectory, "start.html"
    ), _
    System.UriKind.Absolute)

    End Sub

    Best regards,



  • SunnyRon

    Hello Huy

    Thankyou for your advice and help i have tried what you have suggested and i shall continue to use the idea as it has solved all my problems with my application.

    Thanks again for your help.

    This question has been answered! :)

    Take Care

    Anthony,



  • VB 2005 (In Visual Studio 2005) WebBrowser Control - Question