Results 1 to 3 of 3

Thread: Another processes is using the file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    Pennsylvania
    Posts
    133

    Another processes is using the file

    I keep getting an error that another process is using the file when I try to delete it. I know the process must be the for loop. How do I kill all processes.


    PHP Code:
     Dim strJob As String
            strJob 
    lv.SelectedItems(0).Text

            
    'find the job and delete it
            Dim strFileName As String
            Dim strTempFile() As String
            Dim intUbound As Integer
            Dim strRemoveExtension As String


            For Each strFileName In Directory.GetFiles(strJobPath, "*.xml")
                strTempFile = Split(strFileName, "\")
                intUbound = UBound(strTempFile)
                strRemoveExtension = Microsoft.VisualBasic.Left(strTempFile(intUbound), Len(strTempFile(intUbound)) - 4)

                If strRemoveExtension.ToString.Equals(strJob) Then
                    strFileToBeKilled = strFileName
                End If
            Next

            lv.SelectedItems(0).Remove()
            Kill(strFileToBeKilled) 

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    try using Directory.Delete(filename) isntead of kill
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    Pennsylvania
    Posts
    133

    Tried that

    Tried that already, didn't work

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