Results 1 to 3 of 3

Thread: Delete Textline from txt file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    23
    hi,
    Is it possible to get the line number of a certain string in a text file, and you would do it. Also is it possible to delete a certain line from a text file, how would you code it?

    Thanks for Reading this!


  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You could open in input mode and use lineinput method to get all lines and have a counter counting them. Also you could open in binary and get a varlen string and split it into an array of lines.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guest
    Code:
    Dim Count As Long
    Dim MyVar As String
    Count = 1
    Do Until EOF(FileNumber) = False
    Text2.Text = Text2.Text & Count ' show the number
    Line Input #FileNumber, MyVar ' put the contents into MyVar
    Text1.Text = Text1.Text & vbNewLine & MyVar ' make sure multiline is true
    Count = Count + 1 ' update count
    Loop

    this doesnt include the open and close statements..
    I havent tested this code yet, so let me know if it screws up.

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