|
-
Nov 20th, 2004, 08:46 PM
#1
Thread Starter
Addicted Member
Read Multiple lines [Resolved]
Hi,
If I have a textfile with, for an example, 3 different lines, how can I read that lines and put them in 3 different textboxes per line.
thnx
Last edited by Rogier; Nov 22nd, 2004 at 08:55 AM.
-
Nov 20th, 2004, 08:56 PM
#2
do you want to put each line into a textbox by itself, or do you want to split each line into 3 different textboxes? Post an example of what you have, and what you want.
-
Nov 20th, 2004, 08:57 PM
#3
Thread Starter
Addicted Member
I want to put each line into a textbox by itself.
Thanks for replay!
-
Nov 21st, 2004, 06:19 PM
#4
Code:
Dim TestLine
Dim Counter As Integer
Counter = 1
Open "Testfile" For Input As #1
Do While Not EOF(1)
Line Input #1, TestLine
select case Counter
case 1
Textbox1.Text = TestLine
case 2
Textbox2.Text = TestLine
case 3
Textbox3.Text = TestLine
End Select
Counter = Counter + 1
Loop
Close #1
Assumes that there are only 3 lines in the file.
Substitute the name of your textboxes in the select statement.
Last edited by dglienna; Nov 21st, 2004 at 06:22 PM.
-
Nov 22nd, 2004, 08:43 AM
#5
Thread Starter
Addicted Member
-
Nov 22nd, 2004, 11:21 PM
#6
Lively Member
Hi dglienna,
Can you help me to figure out the following issue:
Does VB has any method to get the total line count before loop to read each line? I want to use progressBar control to give the processing percentage of the file. (the lines in file is read one line by one line). To use the ProgressBar control, have to know the total line count and assign the value to the Max property of ProgressBar. Have any advice?
Thanks,
Robert Song
-
Nov 22nd, 2004, 11:25 PM
#7
not unless you save the total first when you are writing the file. then you can read the total, and then loop from there. I do that for a bunch of items that can be changed, yet the program can still deal with them all.
Or, you could compute 25% and display that, then 50% from within the loop that is reading the info.
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
|