Results 1 to 8 of 8

Thread: Deleting sentences in text files

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    14

    Deleting sentences in text files

    How do you only delete certain parts/lines/sentences in a text file?

  2. #2
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Deleting sentences in text files

    Hi larzi,

    Take a look here

    It's a useful site to do with string manipulation.

    About half way down the page is:
    Delete a substring from a string

    Hope this helps
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    14

    Re: Deleting sentences in text files

    Thanks for that, that'll help alot. I'll rate you as a good helper

  4. #4
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Deleting sentences in text files

    Your welcome

    Thanks for the rating.

    If you get stuck, post back here.

    If it's sorted out then mark this thread Resolved, using the 'Thread Tool' menu option above please.
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Deleting sentences in text files

    I usually import text files into a text box and do my editing that way. It is easier (at least I think) and does not require a whole lot of code (which is always good. )

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    14

    Re: Deleting sentences in text files

    Okay, so how do you do that?

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Deleting sentences in text files

    Make sure the textbox is set to multline and you have scroll bars
    vb Code:
    1. 'Replace 'c:\larzi.txt' with the file you want to load to the TextBox
    2. Open "c:\larzi.txt" For Input As #1
    3. Text1.Text = Input(LOF(1), #1)
    4. Close #1
    5.  
    6. 'to save it back to your text file, first, delete the existing one
    7. Kill "c:\larzi.txt"
    8. 'now create a new one
    9. Open "c:\larzi.txt" For Append As #1
    10.    Print #1, Text1.Text
    11. Close #1
    12. End Sub

  8. #8

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    14

    Re: Deleting sentences in text files

    Thanks

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