Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4095954
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:58:27+00:00 2026-05-20T19:58:27+00:00

Hey all i am trying to figure out a way to delete something inside

  • 0

Hey all i am trying to figure out a way to delete something inside a text file but keep everything around it.

An example of this would be:

SDfmifgn349234024jn4tnge0b04tnEFGm34tmn34t0egonkerglnk
318erg4nergpERGhmboergn4t34tmg054
fg94t34tskmsdglnEGgjr894ERG94mrg34tSDFS$45352ty
GGreerkg0gm4m505556g0fdg6555fbd105f1g

And say i wanted to delete the 318erg4nergpERGhmboergn4t34tmg054 and therefore it would turn out to be saved as:

SDfmifgn349234024jn4tnge0b04tnEFGm34tmn34t0egonkerglnk
fg94t34tskmsdglnEGgjr894ERG94mrg34tSDFS$45352ty
GGreerkg0gm4m505556g0fdg6555fbd105f1g

But i am unable to find out how to go about doing that!

I’ve tried this code below that i found:

    Dim dir As New DirectoryInfo(defaultNetworkDrive)

            For Each file As FileInfo In dir.GetFiles()
                If file.Extension = ".txt" Then
                    Dim ioFile As New StreamReader(defaultNetworkDrive & file.Name)

                    Dim ioLine As String ' Going to hold one line at a time
                    Dim ioLines As String ' Going to hold whole file
                    ioLine = ioFile.ReadLine
                    ioLines = ioLine

                    While Not ioLine = ""
                        ioLine = ioFile.ReadLine
                        ioLines = ioLines & vbCrLf & ioLine
                    End While

                    MsgBox(ioLines) 'SHOWS all the lines in the TXT file

                    If InStr(1, ioLines, encryptedText, vbTextCompare) <> 0 Then
                        MsgBox("True")
                    Else
                        MsgBox("False")
                    End If

                    'Dim sw As StreamWriter = file.CreateText("input.txt")
                    'sw.Write(ioLines)
                    'sw.Close()

                    ioFile.Close()
                End If
            Next

I do find it and its TRUE but i am not sure how to go about just deleting that line then saving it!

Any help would be great! :o)

David

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:58:28+00:00Added an answer on May 20, 2026 at 7:58 pm

    You need to check for the string to exclude inside the loop where you read the lines:

    While Not ioLine = ""
      ioLine = ioFile.ReadLine
      If ioLine <> "318erg4nergpERGhmboergn4t34tmg054" then
        ioLines = ioLines & vbCrLf & ioLine
      End
    End While
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all i am trying to figure out how to go about calculating this
Hey all i have been trying to figure out why i am getting this
Hey all i am in need of some help trying to figure out how
Hey all, i am trying to figure out how to calculate the wage for
Hey all, i am in need of some help trying to figure out why
hey all, I'm very confused here, i've been trying to figure this one out.
Hey everyone, my problem is that im trying to figure out how to get
Hey all. Trying to get a little more efficient with lists in Python but
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my
Hey all, I have something of an interesting requirement for my project. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.