By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

VB6 form not responding while reading long text file

P: 10
I am currently creating a program in vb6 that reads thousands of lines from a text file. So I use loop to read each line. It works perfectly but the problem occur when I run the program and try to minimize the form or try to use another application. Seems that the form lost it focus and isnt responding though it is still in the state of processing the loop.
Jan 2 '08 #1
Share this Question
Share on Google+
13 Replies


debasisdas
Expert 5K+
P: 8,127
why don't you read the entire file at once and then process the data line by line .
Jan 2 '08 #2

P: 10
why don't you read the entire file at once and then process the data line by line .
tnx for replying... Is'nt it the same? I mean, If I read the entire file where should I store it?? and how I will retrieve it line by line? I will still use loop right??... sorry Im new to visual basic..
Jan 2 '08 #3

debasisdas
Expert 5K+
P: 8,127
but that certainly involvs less disc I/O.
Jan 2 '08 #4

VijaySofist
100+
P: 107
tnx for replying... Is'nt it the same? I mean, If I read the entire file where should I store it?? and how I will retrieve it line by line? I will still use loop right??... sorry Im new to visual basic..
Hi!

May I Know, For What purpose you are trying to read it Line By Line.

Can you please give your coding here in this forum.


With Regards
Vijay. R
Jan 2 '08 #5

Expert 100+
P: 487
Simply use DoEvents inside the “for” loop. Then you can resize the form.
Note: You cannot read file content line by line. Whenever you open the file to read then the control starts from the first line in that file because there is no line ID to point the control to a particular line.
Jan 2 '08 #6

P: 10
Simply use DoEvents inside the “for” loop. Then you can resize the form.
Note: You cannot read file content line by line. Whenever you open the file to read then the control starts from the first line in that file because there is no line ID to point the control to a particular line.
Hei guys.. Thanks for helping me.. I just need DoEvents inside the loop.. Thanks again...
Jan 3 '08 #7

Expert 5K+
P: 8,434
Note: You cannot read file content line by line.
I think we have a bit of a language mix-up here. I use VB6 to "read file content line by line" all the time. So what are you referring to, Hari?
Jan 4 '08 #8

Expert 100+
P: 487
Sorry for the improper explanation.
I mean if you
1. Open the file and read a line
2. Close the file
3. Again open file and try to read second (or any particular line) line. ‘This is not possible

Is'nt it the same? I mean, If I read the entire file where should I store it?? and how I will retrieve it line by line? I will still use loop right??... sorry Im new to visual basic..
Jan 4 '08 #9

Expert 5K+
P: 8,434
I see what you mean. Yes, each time you open the file the pointer will be reset to the beginning.

Technically, in such a case I suppose you could track where you were up to each time, and reposition after opening the next time. But of course, why would you want to? :)
Jan 4 '08 #10

Expert 100+
P: 487
I agree it is possible technically to reposition and I just pointed do not try like retrieve data from database table using IDs, because one of my teammate faced same problem in VB.
Jan 4 '08 #11

Expert 5K+
P: 8,434
I agree it is possible technically to reposition and I just pointed do not try like retrieve data from database table using IDs, because one of my teammate faced same problem in VB.
It's quite amazing (and amusing) sometimes to see the hoops that people jump through to perform a simple function - am I right? :-)
Jan 4 '08 #12

Expert 100+
P: 487
yes .
Jan 4 '08 #13

P: 2
maybe you can add Doevents in your looping
Mar 6 '10 #14

Post your reply

Sign in to post your reply or Sign up for a free account.