Ab und an habe ich noch einen Fehler wenn ich zwischen den Objekten hin und her klicke:
System.ArgumentException wurde nicht behandelt.
HResult=-2147024809
Message=Ungültiger Parameter.
Source=System.Drawing
StackTrace:
bei System.Drawing.Image.get_FrameDimensionsList()
bei System.Drawing.ImageAnimator.CanAnimate(Image image)
bei System.Drawing.ImageAnimator.ImageInfo..ctor(Image image)
bei System.Drawing.ImageAnimator.Animate(Image image, EventHandler onFrameChangedHandler)
bei System.Windows.Forms.PictureBox.Animate(Boolean animate)
bei System.Windows.Forms.PictureBox.Animate()
bei System.Windows.Forms.PictureBox.InstallNewImage(Image value, ImageInstallationType installationType)
bei System.Windows.Forms.PictureBox.set_Image(Image value)
bei PKT4000Final.Form1.listView1_Click(Object sender, EventArgs e) in d:\c# Übungen\PKT4000Final\PKT4000Final\Form1.cs:Zeile 241.
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.ListView.WmReflectNotify(Message& m)
bei System.Windows.Forms.ListView.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
bei System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
bei System.Windows.Forms.Control.WmNotify(Message& m)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
bei System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
bei System.Windows.Forms.Control.DefWndProc(Message& m)
bei System.Windows.Forms.ListView.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.ListView.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(Form mainForm)
bei PKT4000Final.Program.Main() in d:\c# Übungen\PKT4000Final\PKT4000Final\Program.cs:Zeile 19.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
Dieser Fehler taucht hier auf:
Code:
private void listView1_Click(object sender, EventArgs e)
{
var myobj = new PassPortData();
if (listView1.SelectedItems.Count > 0)
{
myobj = (PassPortData)listView1.SelectedItems[0].Tag;
}
label_type.Text = myobj.type;
label_Code.Text = myobj.code;
label_PassportNr.Text = myobj.passportnr;
label_Surname.Text = myobj.surname;
label_GivenNames.Text = myobj.givenname;
label_Nationality.Text = myobj.nationality;
label_DateOfBirth.Text = myobj.dateofbirth;
label_Sex.Text = myobj.sex;
label_DateOfExpiry.Text = myobj.dateofbirth;
label_MRZ.Text = myobj.MRZ;
pictureBox1.Image = myobj.PassImage;
}
---> diese Zeile:
pictureBox1.Image = myobj.PassImage;
Wie kann ich das verhindern?
In myobj.PassImage steht zu diesem Zeitpunkt:
Flags = "myobj.PassImage.Flags" hat eine Ausnahme vom Typ "System.ArgumentException" verursacht.
usw.