chexwebson
New member
I have been working on the wrong site...visualbasicforum.net...so now I am here...
I am getting an error using the File.Move command
"The parameter is incorrect"
on this line File.Move(NewPath, Path2)
Here is the code:
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim path1 As String = "c:\Code\*.*"
Dim path1a As String = "c:\Code\"
Dim path2 As String = "c:\"
Dim extension As String
Dim Files As String
Dim NewPath As String
Files = Dir(path1)
extension = Path.GetExtension(Files)
NewPath = path1a + Files
Do While Files <> ""
If extension = ".ddd" Then
Files = Dir()
extension = Path.GetExtension(Files)
Else
ListBox1.Items.Add(Files)
NewPath = path1a + Files
File.Move(NewPath, path2)
Files = Dir()
extension = Path.GetExtension(Files)
End If
Loop
End Sub
Any Ideas...? Before the loop, I can send the same string NewPath=path1a + files to a textbox and get the correct looking string, however when in the else statement, it doesnt...am I missing something simple?...
Thanks..
I am getting an error using the File.Move command
"The parameter is incorrect"
on this line File.Move(NewPath, Path2)
Here is the code:
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim path1 As String = "c:\Code\*.*"
Dim path1a As String = "c:\Code\"
Dim path2 As String = "c:\"
Dim extension As String
Dim Files As String
Dim NewPath As String
Files = Dir(path1)
extension = Path.GetExtension(Files)
NewPath = path1a + Files
Do While Files <> ""
If extension = ".ddd" Then
Files = Dir()
extension = Path.GetExtension(Files)
Else
ListBox1.Items.Add(Files)
NewPath = path1a + Files
File.Move(NewPath, path2)
Files = Dir()
extension = Path.GetExtension(Files)
End If
Loop
End Sub
Any Ideas...? Before the loop, I can send the same string NewPath=path1a + files to a textbox and get the correct looking string, however when in the else statement, it doesnt...am I missing something simple?...
Thanks..