Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 21st, 2004, 04:34 PM
Friend of Wrox
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default oTxtStream.ReadLine


I have a text file named TEST.txt that looks like this:


If I want to open this text file and read ONLY "Test2" from it, and put it into a Menu/List box, how do I do so?



Old April 22nd, 2004, 06:56 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

Dim counter

' Create a filesystem object
set FSO = Server.CreateObject("Scripting.FileSystemObject")

Dim Filepath
Filepath = Server.MapPath(Filename)

' Open the file
Dim TextStream
Set TextStream = FSO.openTextFile(filepath, 1, 0)

' Read the file line by line
Do While Not TextStream.AtEndOfStream
   If counter=2 then
        'add this to MENU.
   End if
counter=counter + 1

This works if you are trying to put the particularly the 2nd line in menu. Else you will have to go for other way of doing this.

Hope that helps.


-Vijay G

Similar Threads
Thread Thread Starter Forum Replies Last Post
Readline From Text file and Use as Query phungleon Pro VB Databases 5 February 27th, 2004 10:01 AM
The Readline FUnction Dinesh22 VB.NET 2002/2003 Basics 2 January 29th, 2004 10:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.