Visual Basic .NET » Smart Device Application
VB.Net Issue -- rufus --


Hi,

I'm trying to copy some files from one directory to another with a specific structure.
I found the following code on msdn but it gives an error that the path is not in the correct structure.
He takes the path of the destination and directly pastes the path of the foundfile behind it.
Wath i need is the destination path + filename.

'For Each foundfile As String In My.Computer.FileSystem.GetFiles(sLocatieDesktop,
FileIO.SearchOption.SearchTopLevelOnly, PopsyDos.sReferentie &
"A*.mdb")
' My.Computer.FileSystem.CopyFile(foundfile,
sLocatieLaptop.ToString() & foundfile)
'Next

This is the error it gives System.NotSupportedException was unhandled
Message="The given path's format is not supported."
Source="mscorlib"
StackTrace:
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path,
Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String

str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String
pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String
pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at Microsoft.VisualBasic.FileIO.FileSystem.NormalizeFilePath(String Path,
String ParamName)
at Microsoft.VisualBasic.FileIO.FileSystem.CopyOrMoveFile(CopyOrMove operation, String sourceFileName, String destinationFileName, Boolean overwrite, UIOptionInternal showUI, UICancelOption onUserCancel)
at Microsoft.VisualBasic.MyServices.FileSystemProxy.CopyFile(String sourceFileName, String destinationFileName)
at MainApp.frmMain.C1CommandOverdracht_Click(Object sender,
ClickEventArgs e) in P:\DotNetApp\Vervaet\Source\MainApp\frmMain.vb:line 487
at C1.Win.C1Command.C1Command.OnClick(ClickEventArgs e)
at C1.Win.C1Command.C1Command.Invoke(ClickEventArgs e)
at d6.a(C1CommandLink A_0, a A_1)
at f.c(MouseEventArgs A_0)
at C1.Win.C1Command.C1ToolBar.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String

commandLine)
at MainApp.My.MyApplication.Main(String
Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String

args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String
args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

[Submit Comment]Home