Salvius12 0 Newbie Poster

I cannot figur this out ive been researching. Changeing code structure, Everthing I could think of to get this to work but it keep giving me errors here is the error I get Im pretty sure somewhere in the code its holding onto the file but I dont know where Two heads are better one I guess.
System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalMove(String sourceDirName, String destDirName, Boolean checkHost)
at System.IO.Directory.Move(String sourceDirName, String destDirName)
at TLU_LAUNCHER.Form1.PictureBox3_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Imports System
Imports System.IO
Imports System.IO.Directory
Imports System.Runtime.InteropServices
Imports System.Security.Permissions
Imports System.IO.DirectoryInfo
Imports System.IO.Path
<Assembly: PermissionSetAttribute(SecurityAction.RequestMinimum, Name:="FullTrust")> 





Public Class Form1

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        Me.Close()
    End Sub

    Private Sub PictureBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
        PictureBox1.Image = My.Resources.Exit_2
    End Sub

    Private Sub PictureBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseLeave
        PictureBox1.Image = My.Resources._Exit
    End Sub

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
        Process.Start("FILE NAME")
        MsgBox("Downloading Arma 3 Mods")
    End Sub

    Private Sub PictureBox2_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox2.MouseEnter
        PictureBox2.Image = My.Resources.Download_2

    End Sub

    Private Sub PictureBox2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox2.MouseLeave
        PictureBox2.Image = My.Resources.Download
    End Sub

    <FileIOPermissionAttribute(SecurityAction.PermitOnly, Read:="C:\"), _
    FileIOPermissionAttribute(SecurityAction.PermitOnly, _
    PathDiscovery:="C:\All Users\Desktop"), _
    FileIOPermissionAttribute(SecurityAction.PermitOnly, _
    Append:="C:\Documents and Settings\All Users"), _
    FileIOPermissionAttribute(SecurityAction.PermitOnly, _
        Write:="C:\Documents and Settings\All Users"), _
    FileIOPermissionAttribute(SecurityAction.PermitOnly, _
        ViewAndModify:="C:\Documents and Settings\All Users")> _
    Public Shared Sub PermitOnlyMethod()

    End Sub

    Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click

        Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
        IsArray("\TLU")

        Dim path2 As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
        IsArray("\Program Files (x86)\Steam\steamapps\common\Arma 3")

        System.Threading.Thread.Sleep(3000)

        Directory.Move(path, (path2))

        MsgBox("File Move")




    End Sub


    Private Sub PictureBox3_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox3.MouseEnter
        PictureBox3.Image = My.Resources.Move_File_2
    End Sub

    Private Sub PictureBox3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox3.MouseLeave
        PictureBox3.Image = My.Resources.Move_File
    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.