Results 1 to 13 of 13

Thread: [RESOLVED] Remove temp document

Threaded View

  1. #5

    Thread Starter
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Remove temp document

    Quote Originally Posted by .paul. View Post
    yes you're correct. it would've helped to know you're using .net 2.0

    vb Code:
    1. Public Class Form1
    2.  
    3.     Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    4.         Dim temp As New List(Of String)(IO.Directory.GetFiles("X:\Documents and Settings\XXX\Desktop\vvvvv", "*.doc"))
    5.         temp.RemoveAll(AddressOf isTemp)
    6.     End Sub
    7.  
    8.     Private Function isTemp(s As String)
    9.        Return IO.Path.GetFileName(s).StartsWith("~$")
    10.     End Function
    11.  
    12. End Class
    Thanks Paul

    That worked. I have added to get the FileName as I was trying check whether the FullPath is starting with "~$".

    vb.net Code:
    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         Dim temp As New List(Of String)(IO.Directory.GetFiles("X:\Documents and Settings\XXX\Desktop\vvvvv", "*.doc"))
    3.         temp.RemoveAll(AddressOf isTemp)
    4.  
    5.         For i As Integer = 0 To temp.Count - 1
    6.             ListBox1.Items.Add(temp.Item(i))
    7.  
    8.         Next
    9.     End Sub
    10.  
    11.     Private Function isTemp(ByVal s As String)
    12.         Return IO.Path.GetFileName(s).StartsWith("~$")
    13.     End Function


    Edit:
    I didn't saw that you have edited the code.
    Last edited by akhileshbc; Nov 28th, 2011 at 04:02 AM. Reason: didn't saw the "GetFileName" edit

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

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