Solved

display file in a text box

Posted on 2000-05-13
4
207 Views
Last Modified: 2010-05-02
I have some html files that the user can choose from a list on a form.  The file is a basic html file with mostly text.  I'm interested in finding a way to show the html file(not the code part) in a textbox or the like so the user can preview the file before selecting it.  Is this possible?
0
Comment
Question by:Daron1
4 Comments
 
LVL 7

Expert Comment

by:Vbmaster
ID: 2807594
You can not use a simple textbox for this, you can try the webbrowser control. It's there in the menu Project -> Components -> select "Microsoft Internet Controls" in the list and you will get the control in the Toolbox.
0
 
LVL 14

Accepted Solution

by:
wsh2 earned 75 total points
ID: 2807790
A quick way to generate sample Web Browser code is to use the VB Application Wizard which appears on the same screen as where you select a Standard.Exe project. Answer the first couple of questions anyway you like, then take Yes at the "Do you want your users to be able to access the Internet from your application?". Hit the finish button.. and the VB program is built.

In the project you will find a form named frmBrowser and in it the basics of Internet Webcontrol programming.. complete with backwards and forward code.. and a combobox for previous previously displayed HTML. The method you will be most interested in is the

brwWebBrowser.Navigate URL

Obviously, in this case, you will be using FileNames rather than URLs and as such a call would look like.. brwWebBrowser.Navigate c:\MyPath\MyFile.HTM

From the code generated, copy/paste what you want into your project.. or.. just delete everything you do not want in the VB Application Wizard generated program.. <smile>


0
 

Expert Comment

by:pramesh
ID: 2807857
Try with RichTextbox control.
0
 

Author Comment

by:Daron1
ID: 2808203
This is good.  I have the browser on a form and I set the file for the browser to show like this:

webbrowser.navigate app.path & "\myfile.html"

when I do this, it only shows that the page cannot be found.  I also tried this:

dim mypath as string
mypath= app.path & "\myfile.html"
webbrowser.navigate mypath

this gives the same error.  I know the file is where it should, but why would this not show?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now