So I am trying to move a Folder on my desktop to a folder in my programming files. Everything is their that needs to be at least I think so but it still says it doesnt have access. I am very new to VB.NET like 3 days fresh. I am not asking you to spoonfeed it to me. I am asking for a Step in a certain Direction. Here is my code.

Imports System
Imports System.IO
Imports System.Text
Imports System.IO.Directory
Imports System.Runtime.InteropServices
Imports System.Security.Permissions
<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:\Documents and Settings\All Users"), _
    FileIOPermissionAttribute(SecurityAction.PermitOnly, _
    Append:="C:\Documents and Settings\All Users\Application Data"), _
    FileIOPermissionAttribute(SecurityAction.PermitOnly, _
        Write:="C:\Documents and Settings\All Users\Application Data\Microsoft"), _
    FileIOPermissionAttribute(SecurityAction.PermitOnly, _
        ViewAndModify:="C:\Documents and Settings\All Users\Application Data\Microsoft\Network")> _
    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.DesktopDirectory)
        IsArray("\@TLU")
        Dim path2 As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
        IsArray("\Program Files (x86)\Steam\steamapps\common\Arma 3")

        System.IO.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

Also when I take it to my desktop and run it as Admin and it throws me this error System.IO.IOException: The process cannot access the file because it is being used by another process. Could it be cause the code is holding it cause its not open anywhere else... If so how could I be stopping that from happening.

For Future Refrence this is gonna happen in the debug stage you have to take it to the exe and run it as admin and it wont give you this error. Unless you dont have the right power to get, to the location.

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.