Sunday, 25 August 2013

Code giving me an ArgumentExeption?

Code giving me an ArgumentExeption?

This code is giving me an ArgumentExeption when the correct values are put
in both ComboBoxes, executing the code. The code basically just deletes a
file and replaces it with a modified version taken from another folder.
Here is the exact text of the error message: An unhandled exception of
type 'System.ArgumentException' occurred in Microsoft.VisualBasic.dll
Additional information: The given file path ends with a directory
separator character.
Here's the code: If ComboBox1.Text = "Nokia" And ComboBox2.Text = "HTC"
And My.Computer.FileSystem.FileExists("C:\Users\" + user +
"\Documents\Fiddler2\Scripts\CustomRules.js") Then
My.Computer.FileSystem.DeleteFile("C:\Users\" + user +
"\Documents\Fiddler2\Scripts\CustomRules.js")
My.Computer.FileSystem.CopyFile("Config\OEM\NokiaHTC.js",
destinationFileName:="C:\Users\" + user + "\Documents\Fiddler2\Scripts\")
Else My.Computer.FileSystem.CopyFile("Config\OEM\NokiaHTC.js",
destinationFileName:="C:\Users\" + user + "\Documents\Fiddler2\Scripts\")
End If

No comments:

Post a Comment