Results 1 to 4 of 4

Thread: Help with deleting text file

  1. #1

    Thread Starter
    Addicted Member Beasts's Avatar
    Join Date
    Oct 2006
    Posts
    147

    Arrow Help with deleting text file

    i am making an app which has a listbox with all its items ending up in ".txt"
    it is a listbox NOT a FileListBox. is there a way to delete the .txt in all items of the list? i have tried a lot of things but....

    [Removed by Mod]
    Last edited by RobDog888; Nov 14th, 2006 at 05:58 PM. Reason: Inappropriate thread title and chitchat comment

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Help with deleting text file

    Code:
    Private Sub Command1_Click()
        Dim i As Integer
            For i = 0 To List1.ListCount - 1
                If LCase(Right(List1.List(i), Len(".txt"))) = ".txt" Then
                    List1.List(i) = Left(List1.List(i), InStrRev(LCase(List1.List(i)), ".txt") - 1)
                End If
            Next i
    End Sub
    Or:
    Code:
    Dim i As Integer
        For i = 0 To List1.ListCount - 1
            List1.List(i) = Replace(LCase(List1.List(i)), ".txt", "")
        Next i
    End Sub

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Help with deleting text file

    @Beasts:

    We all be very glad if you can take few seconds more to type full words - this isn't a chit-chat.
    In some contries your title might look quite offencive so it would be nice if you change it...

    Thanks.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Help with deleting text file

    Thread title on posts modified to reflect thread topic/question.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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