VB6 string variable truncating data that it reads from a file

Experts,

I have two questions
1. When I am reading a 600kb text file (HTML code) into a string variable, it is truncating pretty much half of the content. Here is the code I have... where am I going wrong?
Dim fso As New FileSystemObject
Dim f As File
Dim fsoStream As TextStream
Dim strLine As String
Set f = fso.GetFile("C:\Users\Neanderthal\Desktop\MyProj\GMATClubLog.txt")
Set fsoStream = f.OpenAsTextStream(ForReading)
' Read the file line by line, printing the results to the Form
Do While Not fsoStream.AtEndOfStream
     strLine = fsoStream.ReadLine
     Debug.Print strLine
Loop
Len(strLine)

fsoStream.Close
Set fsoStream = Nothing
Set f = Nothing
Set fso = Nothing

Open in new window


2. Basically why I want to read the whole content of the text file is because I want to extract a repeating set of data based on the search criteria . And this is the repeating code. How can I achieve this using vb 6 code?

<td class="topicsName" style="width:100%">
<a class="newestPostIcon" href="http:someURL.com"></a>
<a title="some text" href="http://I want to extract this link.html" ></a> 
</td>

Open in new window


I am attaching the text file to this post.

Thanks!
temp.txt
Jay BaluAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Take a look at the file in a text editor and see if there's anything unusual about the line following the last one that prints in the Immediate Window. It may be that there's something in the file that is being interpreted as EOF.
0
Martin LissOlder than dirtCommented:
I interpreted your question as saying that you were not able to read all the lines, however after commenting out line 12 in your code above I was able to read the complete file. It just occurred to me however that when you say that "it is truncating pretty much half of the content"  that you might mean that individual lines are being truncated. If so can you tell me if any of the following (which is the end of the output from my implementation of your code) contain truncated lines?
                <div class="item">
                    <h4>Main navigation</h4>
                    <ul>
                        <li><a href="/">Home</a></li>
                        <li><a href="/forum/">GMAT Forum</a></li>
                        <li><a href="/forum/gmat-prep-course-class-reviews-ratings-discount-codes-78451.html">GMAT Prep Courses</a></li>
                        <li><a href="/forum/2010-mba-rankings-99812.html">MBA Programs</a></li>
                        <li><a href="/forum/gmat-study-plan-for-gmat-novices-start-your-gmat-journey-80727.html">Self Prep</a></li>
                        <li><a href="/blog/category/blog/">GMAT Blog</a></li>
                        <li><a href="/blog/gmat-tests/">GMAT Test</a></li>
                        <li><a href="/wiki/GMAT">GMAT Wiki</a></li>
                        <li><a href="/">GMAT</a></li>
                        <li><a href="/chat/">Chat</a></li>
                        <li><a href="/blog/about-gmat-club/">About</a></li>
                        <li><a href="/blog/contact-us-2/">Contact</a></li>
                        <li><a href="/blog/partnerships-and-advertising-inquiries/">Advertise</a></li>
                    </ul>
                </div>
                <div class="item">
                    <h4>GMAT Resources</h4>
                    <ul>
                        <li><a href="/forum/gmat-study-plan-for-gmat-novices-start-your-gmat-journey-80727.html">Build Your Study Plan</a></li>
                        <li><a href="/forum/gmat-faq-frequently-asked-questions-about-gmat-75809.html">GMAT Questions</a></li>
                        <li><a href="/forum/top-20-best-gmat-books-on-gmat-club-76582.html">Best GMAT Books</a></li>
                        <li><a href="/forum/all-gmat-cat-practice-tests-links-prices-reviews-77460.html">All the GMAT Tests</a></li>
                        <li><a href="/tests/">GMAT Club Tests</a></li>
                        <li><a href="/forum/gmat-test-dates-95067.html">Test Dates</a></li>
                        <li><a href="/forum/gmat-math-questions-and-intellectual-discussions-7/">GMAT Math</a></li>
                        <li><a href="/forum/verbal-gmat-questions-11/">GMAT Verbal</a></li>
                        <li><a href="/forum/competition-for-the-best-gmat-error-log-template-86232.html">Error Log Templates</a></li>
                        <li><a href="/forum/official-guide-for-gmat-12ed-in-complete-details-76806.html">GMAT Official Guide</a></li>
                        <li><a href="/gmat-score-calculator/">GMAT Score Calculator</a></li>                    
                    </ul>
                </div>
                <div class="item">
                    <h4>Partners</h4>
                    <ul>
                        <li><a href="/blog/courses/e-gmat-discount-promotion-code/?fl=footer">e-GMAT</a></li>
                        <li><a href="/coupon-codes-and-discounts/the-economist-gmat-tutor-discount?fl=footer">Economist GMAT Tutor</a></li>
                        <li><a href="/blog/courses/kaplan-discount/?fl=footer">Kaplan</a></li>
                        <li><a href="/blog/courses/magoosh-gmat-discount/?fl=footer">Magoosh</a></li>
                        <li><a href="/blog/courses/gmat-pill-discount/?fl=footer">GMAT Pill</a></li>
                        <li><a href="/blog/courses/manhattan-gmat-discount/?fl=footer">Manhattan GMAT</a></li>
                        <li><a href="/blog/courses/optimus-prep-discount/?fl=footer">Optimus Prep</a></li>
                        <li><a href="/coupon-codes-and-discounts/princeton-review-gmat-discount-promotion-code?fl=footer">Princeton Review</a></li>
                        <li><a href="/blog/courses/veritas-prep-discount/?fl=footer">Veritas Prep</a></li>
                    </ul>
                </div>
                <div class="item">
                    <h4>MBA Resources</h4>
                    <ul>
                        <li><a href="/forum/2010-mba-rankings-99812.html">Full Time MBA Rankings</a></li>
                        <li><a href="/forum/us-part-time-mba-rankings-class-profiles-and-comparison-84898.html">Part Time MBA Rankings</a></li>
                        <li><a href="/forum/international-schools-rankings-class-profiles-and-comparison-83394.html">International MBA Rankings</a></li>
                        <li><a href="/forum/best-app-tips-77803.html">Best App Tips</a></li>
                        <li><a href="/forum/best-mba-books-99173.html">Best MBA Books</a></li>
                        <li><a href="/forum/school-info-rankings-fit-visits-and-how-to-choose-58751.html">Application Reference</a></li>
                        <li><a href="/forum/mba-interview-tips-and-experiences-89455.html">Interviews</a></li>
                        <li><a href="/forum/best-resume-cv-format-template-tips-85627.html">Resumes</a></li>
                        <li><a href="/forum/admission-consultants-124/">Free Profile Evaluation</a></li>
                        <li><a href="/forum/why-mba-84855.html">Why MBA</a></li>
                    </ul>
                </div>
                <div class="item logo">
                    <a href="/"><img src="/static/img/gmat_logo.png" alt=""/></a>
                    <p>Copyright &copy; GMAT Club</p>
                    <p class="marginBottom">GMAT &reg; is a registered trademark of the Graduate Management Admission Council &reg; (GMAC &reg;). GMAT Club's website has not been reviewed or endorsed by GMAC.</p>
                    <a href="http://deepinspire.com"><img src="/static/img/deep_logo.png" alt=""/></a>
                    <p>&copy; DeeP 2012<br/>
                    Web Design &amp; Development
                    </p>
                </div>
            </div>
            <div class="down">
                <a href="http://www.gmac.com/">www.gmac.com</a><span>|</span><a href="http://www.mba.com/">www.mba.com</a>
            </div>
        </div>
    </div><!-- / #footer -->

    <!-- END footer-new-forum.html -->

       <script type="text/javascript">
       // <![CDATA[
          if (window.reimg_version)
          {
             reimg_loading();
          }
       // ]]>
       </script>
    <!-- GA Content Groups MOD B -->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1891334-1']);
    _gaq.push(['_setPageGroup', '1', 'GMAT Problem Solving (PS)']);
    _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
<!-- GA Content Groups MOD E --><!-- Outbound link tracking -->

<script type="text/javascript">
function isLinkExternal(link) {
    var r = new RegExp('^https?://(?:www.)?' + location.host.replace(/^www./, ''));
        return !r.test(link);
}

$(document).ready(function() {
    $(document).bind('click', function(e) {
        var target = (window.event) ? e.srcElement : e.target;
        while (target) {
            if (target.href) break;
            target = target.parentNode;
        }
        if (!target || !isLinkExternal(target.href)) return true;
        var link = target.href;
    link = location.href.replace(/^http:\/\/gmatclub.com/, '') + '__/outgoing/' + link.replace(/:\/\//, '/');
    _gaq.push(['_trackPageview', link]);
    });
});
</script>

<!-- Sending data to GA when top menu items are hovered -->

<script type="text/javascript">
$(document).ready(function() {
    $('#nav a').hover(
        function(e) {
      if (location.href.search("http://gmatclub.com/forum/") != -1) {
                var trackplace = 'Forum Pages - Menu Dropdown';
            }
      else if ( (location.href == "http://gmatclub.com/") || (location.href == "http://gmatclub.com/?fl=menu") ) {
                var trackplace = 'Home Page - Menu Dropdown';
            }
          else if (location.href.search("http://gmatclub.com/blog/") != -1) {
                var trackplace = 'Blog Pages - Menu Dropdown';
            }
          else {
                var trackplace = 'Other Pages - Menu Dropdown';
            }
          var cat = $(this).parent('li').parent('ul.sub-menu').prev().find('span').html();
          var label = $(this).find('span').html();
          if (!cat) {
              var tracklink = label;
          }
          else {
              var tracklink = cat + ' -- ' + label;
          }
          _gaq.push(['_trackEvent', trackplace, tracklink]);
        },
        function() {
            return true;
        }
    );
});
</script>

<!-- Sending data to GA when Facebook Connect button is clicked -->

<script type="text/javascript">
$(document).ready(function() {
    $('#fb-connect').bind('click',
        function(e) {
          _gaq.push(['_trackEvent', 'Facebook Connect Button', 'click']);
        });
});
</script>

<!-- discounts -->
<script type="text/javascript" src="/static/js/discount.js?2"></script>
    
    <!-- Google Code for General Forum Visitors Remarketing List -->
        <script type="text/javascript">
            /* <![CDATA[ */
            var google_conversion_id = 1071875456;
            var google_conversion_language = "en";
            var google_conversion_format = "3";
            var google_conversion_color = "666666";
            var google_conversion_label = "aJ2TCIyY-gEQgIuO_wM";
            var google_conversion_value = 0;
            /* ]]> */
        </script>
        
        <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
        </script>
        
        <noscript>
            <div style="display:inline;">
                <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1071875456/?label=aJ2TCIyY-gEQgIuO_wM&amp;guid=ON&amp;script=0"/>
            </div>
        </noscript>

        </body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jay BaluAuthor Commented:
Martin Liss - Thanks for your response. I was in fact mistaken, What happened was when I tried to print it in the VB Immediate window, it was not printing completely (could there be a limit on how much contact can be printed in that window?). But when I wrote it back to a text file, it was printing everything there. So... false alarm. Thanks for your answer though.
0
Martin LissOlder than dirtCommented:
The Immediate Window will show at most 199 lines.

You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0
Jay BaluAuthor Commented:
Would you be interested in taking a quick look at my other question too?

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_28568498.html

Sorry, if I am hijacking this post.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.