|
-
Feb 9th, 2012, 03:13 AM
#1
Thread Starter
New Member
-
Feb 9th, 2012, 03:29 AM
#2
Re: Special Directory's Not Working..
The problem is that you are assigning the folder path to a variable and then not using that variable. Anything INSIDE the double quotes is literal text. If you want to use a String variable then it must be OUTSIDE the double quotes. Try running this code to see the difference:
Code:
Dim str1 As String = "Hello"
Dim str2 As String = "World"
MessageBox.Show("str1 & & str2")
MessageBox.Show(str1 & " " & str2)
Last edited by jmcilhinney; Feb 9th, 2012 at 03:40 AM.
-
Feb 9th, 2012, 03:34 AM
#3
Thread Starter
New Member
Re: Special Directory's Not Working..
 Originally Posted by jmcilhinney
The problem is that you are assigning the folder path to a variable and then not using that variable. Anything INSIDE the double quotes is literal text. If you want to use a String variable then it must be OUTSIDE the double quotes. Try running this code to see the difference:
Code:
Dim str1 As String = "Hello"
Dim str2 As String = "World"
MessageBox.Show("var1 & & var2")
MessageBox.Show(var1 & " " & var2)
like i said im abit slow... im not quite sure what im meant to be running outside the quotes...
-
Feb 9th, 2012, 03:41 AM
#4
Re: Special Directory's Not Working..
Sorry, I made an error in that code so it wouldn't run. I've fixed it now. Run the code I provided, look at the results it produces, look at the difference in the code and it should be fairly clear from what I said in my previous post what the principle is that my code is demonstrating and how you can apply that to your own code to fix your error.
-
Feb 9th, 2012, 03:55 AM
#5
Thread Starter
New Member
Re: Special Directory's Not Working..
oh yeah i see what you mean... however i tried replacing and now its aggrivating me... i can't seem to intergrate it with my code correctly ;/ it keeps scrweing up no matter which way i format it.....
Here was one attempt:
vb Code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim fileP As String fileP = My.Computer.FileSystem.SpecialDirectories.Desktop Dim str1 As String = FileCopy(fileP / "Test.bat", fileP / "Test Folder") Dim str2 As String = "Moved!" MessageBox.Show("str1 & & str2") MessageBox.Show(str1 & "File Moved" & str2) End Sub End Class
-
Feb 9th, 2012, 04:59 AM
#6
Re: Special Directory's Not Working..
try this:
vb Code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim fileP As String
fileP = My.Computer.FileSystem.SpecialDirectories.Desktop
Dim source As String = fileP & "\Test.bat"
Dim destination As String = fileP & "\Test Folder\Test.bat"
FileCopy(source, destination)
MessageBox.Show(String.Format("'{0}' File Copied to '{1}'", source, destination))
End Sub
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 9th, 2012, 07:12 AM
#7
Thread Starter
New Member
Re: Special Directory's Not Working..
 Originally Posted by .paul.
try this:
vb Code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim fileP As String
fileP = My.Computer.FileSystem.SpecialDirectories.Desktop
Dim source As String = fileP & "\Test.bat"
Dim destination As String = fileP & "\Test Folder\Test.bat"
FileCopy(source, destination)
MessageBox.Show(String.Format("'{0}' File Copied to '{1}'", source, destination))
End Sub
Thank you so much, your a life saver, ill add you to the credits <3, thanks alot.. <3
you to jmcilhinney , quick reply to, Thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|