Results 1 to 11 of 11

Thread: Display Resource File Webpage >> Form

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Resolved Display Resource File Webpage >> Form

    when it comes to images etc I know how to place the resource file, but when I want to display a webpage that is saved, how do I display this onto the form?

    I have copied and pasted the file to the resources, yet I noticed it looks like a text file??

    Is it possible to display the file using the webbrowser control by linking it to that file, just not sure.

    Thank you
    Last edited by jokerfool; Nov 22nd, 2015 at 08:24 AM. Reason: Because the other poster made me feel like an idiot

  2. #2
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Display Resource File Webpage >> Form

    Hi,

    When you have added files to your Resources, files like Executable and Picture files are typically stored as Binary (Byte Array) whereas Text Based files are typically stored as Strings. To confirm the file storage type adopted for a particular file you can click on the file and Look at the File Type property in the Properties tab.

    If your file is just a text file then you can load the WebBrowser Control using:-
    vb.net Code:
    1. WebBrowser1.DocumentText = My.Resources.YourFileResourceAsString

    But, if your file is Binary then you can load the WebBrowser control using a MemoryStream:-
    vb.net Code:
    1. Dim myFileStream As New MemoryStream(My.Resources.YourFileResourceAsByteArray)
    2. WebBrowser1.DocumentStream = myFileStream

    Hope that helps.

    Cheers,

    Ian

  3. #3

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Display Resource File Webpage >> Form

    Its an htm file.

  4. #4
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Display Resource File Webpage >> Form

    Quote Originally Posted by jokerfool View Post
    Its an htm file.
    OK, so read what I said and choose the right option for you.

    Cheers,

    Ian

  5. #5

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Display Resource File Webpage >> Form

    I am not understanding this.

  6. #6
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Display Resource File Webpage >> Form

    Let me try again,

    Go to your Project Properties (Main Menu, Project, Project Properties), click on the Resources Tab and then click on the File in question in the Resources Window. Now, from the Main Menu again, click View and then scroll down and click Properties Window. This is what will tell you, via the FileType Property, how the file has been stored as part of the Project. This is either Text or Binary. Now go back to Post #2 to finish off.

    Cheers,

    Ian

  7. #7

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Display Resource File Webpage >> Form

    Ahhh, so I add a webbrowser and double click it and add

    Code:
    WebBrowser1.DocumentText = My.Resources.Antivirus_Malware
    But when I press play I dont see anything, I also dont see any errors either. So it must be working, just not displaying anything. Any reason why?

  8. #8
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Display Resource File Webpage >> Form

    You need to stop and think about what it is you want to do and compare that with what it is that you are actually doing.

    Firstly, that fact that you did not even have a WebBrowser Control added to your project just seems a bit strange to me and yet the penny seemed to drop after my last post.

    Secondly, you have just added the code I demonstrated to your project by just double clicking the WebBrowser control and pasting in the relevant code and expect things to just magically happen. When double clicking the WebBrowser control the default Event Handler Code that is added to your project is the DocumentCompleted Event. Do you know what this event does and do you know when it fires? If not then you need to do some research on that fact to understand why your code does not work. You then need to decide where you want to put the code that populates the DocumentText of the WebBrowser control.

    Finally, what has a “Play Button” got to do with anything mentioned in this Thread so far? You do not need to answer that question but maybe this is where your code is supposed to go?

    Cheers,

    Ian

  9. #9

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Display Resource File Webpage >> Form

    Thanks for being arrogant. I will pay someone to help me instead

  10. #10

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Display Resource File Webpage >> Form

    This thread can now be closed thanks to people like you.

  11. #11
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: Display Resource File Webpage >> Form

    Quote Originally Posted by jokerfool View Post
    Thanks for being arrogant. I will pay someone to help me instead

    This thread can now be closed thanks to people like you.
    Excuse me?

    My sincere apologies for trying to help you.

    Good luck in your future endeavours and I will ask the Mods to remove that ungrateful rep that you posted.

    Ian

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