|
-
Nov 21st, 2015, 09:14 AM
#1
Thread Starter
Hyperactive Member
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
-
Nov 21st, 2015, 11:25 AM
#2
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:
WebBrowser1.DocumentText = My.Resources.YourFileResourceAsString
But, if your file is Binary then you can load the WebBrowser control using a MemoryStream:-
vb.net Code:
Dim myFileStream As New MemoryStream(My.Resources.YourFileResourceAsByteArray)
WebBrowser1.DocumentStream = myFileStream
Hope that helps.
Cheers,
Ian
-
Nov 21st, 2015, 02:02 PM
#3
Thread Starter
Hyperactive Member
Re: Display Resource File Webpage >> Form
-
Nov 21st, 2015, 05:12 PM
#4
Re: Display Resource File Webpage >> Form
 Originally Posted by jokerfool
Its an htm file.
OK, so read what I said and choose the right option for you.
Cheers,
Ian
-
Nov 21st, 2015, 11:14 PM
#5
Thread Starter
Hyperactive Member
Re: Display Resource File Webpage >> Form
I am not understanding this.
-
Nov 22nd, 2015, 01:53 AM
#6
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
-
Nov 22nd, 2015, 05:31 AM
#7
Thread Starter
Hyperactive Member
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?
-
Nov 22nd, 2015, 06:12 AM
#8
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
-
Nov 22nd, 2015, 08:14 AM
#9
Thread Starter
Hyperactive Member
Re: Display Resource File Webpage >> Form
Thanks for being arrogant. I will pay someone to help me instead
-
Nov 22nd, 2015, 08:23 AM
#10
Thread Starter
Hyperactive Member
Re: Display Resource File Webpage >> Form
This thread can now be closed thanks to people like you.
-
Nov 22nd, 2015, 09:21 AM
#11
Re: Display Resource File Webpage >> Form
 Originally Posted by jokerfool
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|