Results 1 to 4 of 4

Thread: Reading a txt file into a html page using vb script

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    1

    Unhappy

    Could someone please help me in trying to read information from a text file into a web page (text box on a form).
    AS i've tried everything and can't find out how. An example page would be greatly appreciated.

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    hi neoknight

    4guysfromrolla has a good description on how to do what you ask.

    check out http://www.4guysfromrolla.com/webtech/040699-1.shtml

    hope this helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I just read that link as well Ian!

    but I knocked-up a complete example...
    Code:
    <%@ Language=VBScript %>
    <%option explicit%>
    <HTML>
    
    <BODY>
    <%
    	Const ForReading = 1, ForWriting = 2, ForAppending = 8
    	Dim fso, f,myText
    	
    	Set fso = CreateObject("Scripting.FileSystemObject")
    	
    	Set f = fso.OpenTextFile("c:\testfile.txt", ForReading, True)
    	
    	Do While not f.AtEndOfStream
    		myText = myText & f.ReadLine & vbCrLf
    	Loop 
    
    
    	f.Close
    
    	Response.Write("<input value='" & mytext & "'>")
    %>
      
    </BODY>
    </HTML>
    Mark
    -------------------

  4. #4
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    cheers mark, it's just that I didn't have enough time to do it myself.

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width