PDA

Click to See Complete Forum and Search --> : Displaying Files in a Text Box


mgifford
Jan 11th, 2000, 05:57 AM
I am new to VB and having a hard time displaying a file in a text box. I have figured out the code to get the file to open but haven't been able to write the code so that a report will display in the text box instead of just the file name. Can anyone help?

------------------
M Gifford

cas21
Jan 11th, 2000, 09:41 AM
an easy way is to use a RichTextBox

RichTextBox1.LoadFile pth

pth is a variable for Path and FileName

ivyl
Jan 12th, 2000, 05:05 PM
You can use the following code:

FileName$ = "c:\test.txt"
Open FileName$ For Input As #1
Text1.Text = Input(LOF(1), 1)
Close

netSurfer
Jan 12th, 2000, 08:47 PM
Quick question, what is the LOF?

Joacim Andersson
Jan 12th, 2000, 09:10 PM
LOF = Length Of File

------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)

netSurfer
Jan 12th, 2000, 09:18 PM
Ah, thanks. I guess if I would have thought a little harder I might have figured that one out. Ah well, what can I say, it's early Thursday morning and I'm still asleep. Honest, that's the reason :-)