Copy contents of a file into a textbox

texasrsx
04-24-2003, 09:16 AM
I have a directory of sequentially named text files and I would like to be able to display the contents of each in a userform. The userform would have a textbox that would contain the text and two buttons 'Back' and 'Next' which would allow the user to cycle through the files in the directory. My question is, how do I get the data from the text file into the textbox without having to open the file?

reboot
04-24-2003, 09:30 AM
You don't get the content of a file without opening the file.

texasrsx
04-24-2003, 09:36 AM
You don't get the content of a file without opening the file.

I should have been more clear. I mean I don't want to have to view the file before copying the content. It doesn't matter now anyway, I found the code I was looking for. Thanks for the replay though.

Daraja
04-24-2003, 09:45 AM
I think you should use the Open function, to open the file. For example:


Dim strContent As String
Open AppPath & "File1.txt" For Input As #1
Do Until EOF(1)
Line Input #1, strContent
Text1.Text = Text1.Text & strContent
Loop
Close #1


The Do Until EOF marker keeps cycling through the file, until the end of the file is reached.

I hope this is what you mean...

texasrsx
04-24-2003, 10:02 AM
I think you should use the Open function, to open the file. For example:


Dim strContent As String
Open AppPath & "File1.txt" For Input As #1
Do Until EOF(1)
Line Input #1, strContent
Text1.Text = Text1.Text & strContent
Loop
Close #1


The Do Until EOF marker keeps cycling through the file, until the end of the file is reached.

I hope this is what you mean...

That is what I was looking for. Thank You.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum