HELP PLEASE PEOPLE

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
15 posts Page 1 of 2
Contributors
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

HELP PLEASE PEOPLE
muttley1968
Hello would like to make a application to move one file from one place to anouther but dont know how to i want to move a RAR file from dekstop/downloads ect to .minecraft texturepacks folder does anyone have and idea how to do this no ideas at all on how to move them
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Re: HELP PLEASE PEOPLE
Skillful
Code: Select all
System.IO.File.Copy("File to copy","Destination to copy to")
Simple :)
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: HELP PLEASE PEOPLE
muttley1968
OMG Thanks soo mutch mate
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Re: HELP PLEASE PEOPLE
Skillful
Don't forget to mark my answer as the correct one and please lock the thread now :)
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: HELP PLEASE PEOPLE
muttley1968
i did it like this people just soo you know :P
Code: Select all
  
  Dim rName As String = My.User.Name
    Dim lSlash As Integer = rName.LastIndexOf("\")
    Dim fName As String = rName.Substring(lSlash + 1)
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
System.IO.File.Copy("C:\Users\" + fName+ "\AppData\Roaming\.minecraft\texturepacks", TextBox1.Text)
    End Sub
but when i run it it all works but says acsess is denied
Last edited by muttley1968 on Tue May 22, 2012 9:03 pm, edited 1 time in total.
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Re: HELP PLEASE PEOPLE
Skillful
Code: Select all
System.IO.File.Copy("File To Copy", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString & ".minecraft\texturepacks")
:)
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
Skillful
Skillful Coders
Skillful Coders
Posts: 969
Joined: Tue Nov 16, 2010 10:07 am

Re: HELP PLEASE PEOPLE
Skillful
If you get an Access Denied error, just run the app as admin :)
Instead of LOL use this -
LSIBMHBIWFETALOL

Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: HELP PLEASE PEOPLE
muttley1968
Well thanks but ones again i am getting the same eror
Image
i dont know why i have made it so it runs in admin as well still comes up though
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: HELP PLEASE PEOPLE
mandai
File.Copy does not work with folders. If you want to copy a folder you will need to list the files and copy them individually.
You could use something like this:
Code: Select all
        If Not Directory.Exists(TextBox1.Text) Then
            Directory.CreateDirectory(TextBox1.Text) 'destination folder
        End If

        Dim source As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\texturepacks"

        Dim paths As String() = Directory.GetFiles(source)
        For i As Integer = 0 To paths.Length - 1
            Dim filename As String = Path.GetFileName(paths(i))
            File.Copy(paths(i), TextBox1.Text & "\" & filename)
        Next
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: HELP PLEASE PEOPLE
muttley1968
i want to copy a file to a folder and when i put it
System.IO.File.Copy("File To Copy","location") layout it didnt work yet
when i switched it around it worked just fine soo
15 posts Page 1 of 2
Return to “Coding Help & Support”