|
-
Feb 21st, 2000, 09:45 PM
#1
Thread Starter
Hyperactive Member
I know this method to open a textfile into a textbox:
VB Code:
Filenum = FreeFile
Open "c:\File1.txt" For Input As Filenum
T1_DTBANK.Text = Input(LOF(Filenum), Filenum)
Close Filenum
My progam loads some paths from five textfiles (each with one line, e.g. "C:\XXXXXX\XXXXXXX.TXT").
Now my question:
Is there a way, that there is only one textfile with all this things?
Is it possile, that I open the textfile,
so the textbox no. 1 has the text of the first line (of the textfile), the textbox no.2 has the text of the second line, and so on.
How do I have to modify the code?
I hope you understant my problem.
Thanks for some help, Matt
Last edited by Matt-D; Sep 18th, 2003 at 03:25 PM.
-
Feb 21st, 2000, 10:03 PM
#2
Lively Member
If I am to understand you correctly, I think you are after something that uses the LINE INPUT syntax. (I have assumed your Text Box controls are part of a control array)
Code:
Dim iFreeFile as integer
Dim iControlArrayInstance as Integer
iFreeFile = FreeFile
iControlArrayInstance = 0
Open "C:\File.txt" For Input As #iFreeFile
Do While Not EOF(iFreeFile)
'Read one whole line at a time
Line Input #iFreeFile, sMyString
'Place the text in the relevant TextBox (Control Array)
txtMyTextBoxControlArray(iArrayInstance) = sMyString
iArrayInstance = iArrayInstance + 1
Loop
Close #iFreeFile
The five lines from your txt file should now be in five different text box controls.
------------------
Ishamel
[email protected]
How can I tell you I love you when you are sitting on my face?
[This message has been edited by Ishamel (edited 02-22-2000).]
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
|