I have a Text file with 4 lines in the file, i want to display each line in seperate text boxes 1 text box for 1 line of text, iam new to this so sorry if i have not explained well any help would be great thanks
Printable View
I have a Text file with 4 lines in the file, i want to display each line in seperate text boxes 1 text box for 1 line of text, iam new to this so sorry if i have not explained well any help would be great thanks
Welcome to VB Forums!
It would be easiest to do if your textboxes were part of a contro, array. What you would do would be to define a counter. Then use Line Input statement to read a line. each time you read the line move the input to a textbox(counter) and then increment the counter.
eg
VB Code:
Dim ff As Integer Dim strLine As String Dim lngIndex As Long ff = FreeFile Open "C:\temp\four lines.txt" For Input As ff Do Until EOF(ff) Line Input #ff, strLine Text1(lngIndex).Text = strLine lngIndex = lngIndex + 1 Loop
Iam using the line input but the whole text file ends up in one text box
could u please show am example thanks
Thankyou very much this has help me out big time
You're welcome. Now you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button. That will let everyone know that you have your answer.