|
-
Nov 29th, 2000, 06:19 AM
#1
Thread Starter
Member
How do i alter this code to read the entire txt fileinto my text box without going through each Line input command.
Is there a do EOF for this sort of thing?
Dim intFile As Integer
Dim strText As String
'String Loader
intFile = FreeFile
Open "C:\Test.txt" For Input As #intFile
Line Input #1, strText ' Get text from line 1
Text1.Text = strText
Line Input #1, strText
text2.Text = strText ' Get text from line 2
' repeat process for 3rd line 4th and so on...
Close intFile
Any tips as always are appreciated.
M.
-
Nov 29th, 2000, 07:26 AM
#2
New Member
try this
/** let sFile denote the path where ur file exists **/
Open sFile For Input As InFile
While Not EOF(InFile)
Line Input #InFile, NextStatement
wend
/** Here NextStatement is a variable storing the line. Now put the textboxes in an array ,say txtStatement.**/
so the code becomes ..
Open sFile For Input As InFile
While Not EOF(InFile)
Line Input #InFile, NextStatement
txtStatement(i).text = NextStatement
i = i + 1
wend
If ur not satisfied with the reply pls inform me.
-
Nov 29th, 2000, 07:26 AM
#3
Dim intFile As Integer
Dim strText As String
intFile = FreeFile
Open "C:\Test.txt" For Input As #intFile
strText = Input(LOF(1), 1)
Close #intFile
-
Nov 29th, 2000, 07:29 AM
#4
_______
<?>
Code:
'Open a file in binary mode and read into a textbox or string
Dim sHolder As String
Dim intNum As Integer
Dim sFileName As String
'open for binary and read
sFileName = "C:\My Documents\MyFile.txt"
intNum = FreeFile
Open sFileName For Binary As intNum
sHolder = Space(LOF(1))
Get #1, , sHolder
Close intNum
'assign the text to a textbox
Text1 = sHolder ' for a string (strString = sholder)
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|