Solved

display file in a text box

Posted on 2000-05-13
4
206 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

747 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

14 Experts available now in Live!

Get 1:1 Help Now