Hi people i'm a completly new to this i've got a form with rich text box and want to open a txt file (or other files) in the rich text box. Ive managed to work out how the open command works just wait a point in the right direction really i'm using visual basic 5

Thanks

Something to note when using a richtextbox, is the method "loadfile", which will load a .txt file (or an RTF File... Actually, it will load any file, but you might want to stick to .txt and rtf with it). You can do it that way, which is real easy, but not so much fun. Like this richtextbox1.loadfile "c:\boot.ini" , which load the file "boot.ini" from root of the c drive (c:\). If you are dead set on doing it the hard way (which I am) you can use open, which follows this syntax open path for action as handle

Hi thanks for the pointer managed to get it to work but only opens RTF documents and not anything else, can I get it to open and view any files?

Most likely only .txt and rtf files. If you want to do processing for other kinds of files, you'll need to manually try to format the data and display it. One trick that I thought was a pretty good plan, was have the program check to see if MS word is installed, and if so, have VB use Word behind the scenes to convert the file to a .txt or a .rtf, and then display it that way (I mean for documents, if you want to do pictures and stuff, you'll have to use picturebox's or apis with device contexts....)

This article has been dead for over six months. Start a new discussion instead.