Results 1 to 2 of 2

Thread: HTML files not being displayed

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Halifax, Nova Scotia
    Posts
    11

    HTML files not being displayed

    Hi all,

    I posted a similar question in a different forum, but didn't get a response so I thought I'd try this one.

    I have a label that displays a name and a command button on one form. When user clicks the button, I want the HTML page that corresponds to the name in the label to be displayed in a web browser on a separate form.

    ie. The name in the label is 'Alaunia', when command button is clicked the HTML file Alaunia_NEW.html is to be displayed on a separate form in a webbrowser.

    Here's the code I have,

    Private Sub Form_Load()
    If lblShip1.Caption = "Anna Salen" Then
    WebBrowser1.Navigate ("C:/Documents and Settings/itcoop/Desktop/kiosk/Ships HTML pages/wallofships_grigori/shipsmain/Anna_Salen_NEW.htm")
    End If

    If lblShip1.Caption = "Andes" Then
    WebBrowser1.Navigate ("C:/Documents and Settings/itcoop/Desktop/kiosk/Ships HTML pages/wallofships_grigori/shipsmain/Andes_NEW.htm")
    End If
    End Sub

    etc.

    (lblShip1 contains the name by way of a string from other form)

    When I click the command button, I get "Page Cannot Be Displayed", however, when I block out the If Statements, the second HTML file "Andes" is displayed.

    Am I not able to use If statements with the webbrowser control ?(was told I could) How can I fix this code or code my command button to do what I want?

    Thanks,

  2. #2
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    Here's a couple of things you can do:

    1) Open Internet Explorer and manually browse and open the HTML file that you want to display. Now in the address bar will be the complete path to the HTML file to use in your VB code. This just ensures that you don't have a typo.

    2) Change WebBrowser1.Navigate to WebBrowser1.Navigate2

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