Hi,
executing this code i get this error
Dim dir = "C:\Pippo\conversations\conversation\"
Dim CheckDir As Char = System.IO.Path.GetInvalidPathChars(dir)
Dim data() As Byte = File.ReadAllBytes("C:\Ferie\2020_0908_155849_185.jpg")
File.WriteAllBytes(dir & "2020_0908_155849_185A.jpg", data)
System.InvalidCastException
HResult=0x80004002
Messaggio=Cast not valid from string "C:\Pippo\conversations\conversat" to 'Integer' type.
Origine=Microsoft.VisualBasic
Stack analysis:
in Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
in ProvaPath.Form1.Button1_Click(Object sender, EventArgs e) in C:\Progetti\ProvaPath\ProvaPath\Form1.vb: riga 9
in System.Windows.Forms.Control.OnClick(EventArgs e)
in System.Windows.Forms.Button.OnClick(EventArgs e)
in System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.ButtonBase.WndProc(Message& m)
in System.Windows.Forms.Button.WndProc(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
in System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
in System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
in ProvaPath.My.MyApplication.Main(String[] Args) in : riga 83
This exception was originally thrown in the following call stack:
Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(string, System.Globalization.NumberFormatInfo)
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(string)
Eccezione interna 1:
FormatException: Incorrect input string format.
How is it possible?
Thanks.