Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post

    Question Visual basic: making a html file appear in a window

    Hey guys. i was wondering if anyone knew how I could make a sort of I Frame and make a html file, that is stored localy, apper in this window.

    Any help please

    thanks guys.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yup its some sort or control, like web browser or something and you just set the url of it.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #3
    New Coder
    Join Date
    Apr 2004
    Location
    Earth, located in Milky Way galaxy
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do u mean say... u want to embed html to your Visual Basic form... if thats the one, i can help.
    You must dream to be a succesful person, go to sleep... www.niumai.tk is my site

  • #4
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, it's the WebBrowser control. Here's an example.

    shmoove

  • #5
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    ok guys thanks a lot, i got it to work. Now I have one more problem.

    As i is loading a html file from the local machine, i have to provide a link to the file. Currently im useing this.

    PHP Code:
    Private Sub Form_Load()
      
    WebBrowser1.Navigate "C:\index.htm"
    End Sub 
    but this means that the html file has to be in c:\ and i dont want that, i want it to be in the same directory as the .exe file. I have tried changeing it to

    PHP Code:
      WebBrowser1.Navigate "index.htm" 
    and
    PHP Code:
      WebBrowser1.Navigate "\index.htm" 
    but have no luck. Do you guys know of a way I can get around this?

    Thanks for your time.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    combine the results of App.Path with your filename
    I am the luckiest man in the world

  • #7
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    but thats the problem, im not going to know the path of where the files are going to be stored. I can get it to work, but with a set path. I dont want a set path, i want the two files to be able to get put in the same folder anywhere on the computer and the programme will run.

    thanks for your help.

  • #8
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    App.Path will evaluate to the folder containing the exe at runtime. So as long as the files are in the same folder as the exe (or a specific subfolder if you include that with the filename), it will work no matter where the application is installed.

    shmoove

  • #9
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    ah, ok, i understand.

    So how would i go about useing this. Iv taken a look at that link and its a little confuesing to me, lol.

    Am new to VB

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its something like

    WebBrowser1.Navigate App.Path & "\myfile.htm"

    you may need to remove the slash before myfile.htm

    In VB you can combine all sorts like tha, i think the best thing is when you type a control name and then press the . button and get a full list of options.

    The otherthing is looking at alternative names for stuff e.g. functions/options/cases/properties for one of a better word, as it really helped me as a web developer to sort of get my head round VB.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #11
    Regular Coder
    Join Date
    Jul 2004
    Posts
    201
    Thanks
    8
    Thanked 1 Time in 1 Post
    Ha, had a little play around with that app.path thing and it wouldnt work, so i tried setting it as a variable first then loading it and finaly got it to work. thanks for your helo mate

    this is what i used:

    PHP Code:
    Private Sub Form_Load()
      
    Dim loc As String
      loc 
    App.Path "\" & "Index.htm"
      WebBrowser1.Navigate loc
    End Sub 

  • #12
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you can use to brackets to enclose stuff, as it can get round stuff that combines things together, just like you do in maths.

    if you mix numbers and strings, you have to use str(expression) so it makes it all to a string.

    so i think you could rewrite it on msn as

    Code:
     Private Sub Form_Load() 
    
      WebBrowser1.Navigate (App.Path & "\" & "Index.htm") 
    End Sub
    if you want add me on msn mattienewt@hotmail.com as i'm doing some vb stuff so i might be able to help you a bit as i'm in a similair boat as you.


    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #13
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If Navigate is a Sub and not a function (which I think is the case), then in order to use brackets you would need the Call keyword:
    Code:
    Call WebBrowser1.Navigate (App.Path & "\" & "Index.htm")
    or else the compiler will complain (one of those nice little VB quirks)

    shmoove


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •