VB6 form not responding while reading long text file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rizzie
    New Member
    • Nov 2007
    • 10

    VB6 form not responding while reading long text file

    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.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    why don't you read the entire file at once and then process the data line by line .

    Comment

    • rizzie
      New Member
      • Nov 2007
      • 10

      #3
      Originally posted by debasisdas
      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..

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        but that certainly involvs less disc I/O.

        Comment

        • VijaySofist
          New Member
          • Jun 2007
          • 107

          #5
          Originally posted by rizzie
          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

          Comment

          • CyberSoftHari
            Recognized Expert Contributor
            • Sep 2007
            • 488

            #6
            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.

            Comment

            • rizzie
              New Member
              • Nov 2007
              • 10

              #7
              Originally posted by CyberSoftHari
              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...

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                Originally posted by CyberSoftHari
                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?

                Comment

                • CyberSoftHari
                  Recognized Expert Contributor
                  • Sep 2007
                  • 488

                  #9
                  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

                  Originally posted by rizzie
                  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..

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #10
                    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? :)

                    Comment

                    • CyberSoftHari
                      Recognized Expert Contributor
                      • Sep 2007
                      • 488

                      #11
                      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.

                      Comment

                      • Killer42
                        Recognized Expert Expert
                        • Oct 2006
                        • 8429

                        #12
                        Originally posted by CyberSoftHari
                        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? :-)

                        Comment

                        • CyberSoftHari
                          Recognized Expert Contributor
                          • Sep 2007
                          • 488

                          #13
                          yes .

                          Comment

                          • rieeatmee
                            New Member
                            • Mar 2010
                            • 2

                            #14
                            maybe you can add Doevents in your looping

                            Comment

                            Working...