|
-
Nov 11th, 2000, 04:39 PM
#1
Thread Starter
Hyperactive Member
Hi,
I need to read-in contents of a text file (Readme file) into a text box on my Help.frm. What would be the right approach? Can anyone help?
Thanks.
-
Nov 11th, 2000, 05:06 PM
#2
Fanatic Member
Maybe this code helps you. 
Code:
Dim oneLine As String 'one line of the file
'open the file
Open "c:\myfile.txt" For Input As #1
'read each line and add it to the textbox
Do
'read a line
Line Input #1,oneLine
'add it to the textbox
Text1.Text = Text1.Text & oneLine & VBCRLF
Loop Until Eof(1)
'close the file
Close #1
-
Nov 11th, 2000, 05:43 PM
#3
Hyperactive Member
Maybe you should cosider using a RichTextBox control. It does whatever a regular Textbox would do but even better. If your help text file is very long you should use a RichTextBox.
Code:
RichTextBox1.LoadFile "C:\MyTxtFile.txt", 1
-
Nov 12th, 2000, 11:05 AM
#4
Fanatic Member
The size limit of a textbox is 64 KB, so I don't think you need a richtextbox. But a richtextbox also supports formatting.
-
Nov 12th, 2000, 11:27 AM
#5
The RTF Box uses up a lot more resources than a standard Textbox.
Here is a faster way of loading the file. (using a standard TextBox)
Code:
Open "MyFile.txt" For Input As #1
Text1 = Input(LOF(1), 1)
Close #1
-
Nov 16th, 2000, 09:35 PM
#6
Frenzied Member
well, what is the limit in size for a rtb?
Wengang
Wen Gang, Programmer
VB6, QB, HTML, ASP, VBScript, Visual C++, Java
-
Dec 23rd, 2000, 05:15 AM
#7
The limit for a RTF box is the virtual memory that Windows has assigned your program.
That is it doesn't have a limit other than the RAM.
-
Dec 24th, 2000, 08:51 PM
#8
Frenzied Member
Wen Gang, Programmer
VB6, QB, HTML, ASP, VBScript, Visual C++, Java
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|