Hallo,
in einem gebundenen DGV erhalte ich nach Wechsel in die unterste Zeile (also neuer Datensatz) und verlassen derselben einen Fehler, wenn ich diese Aktion 2x ausführe.
Die Fehlermeldung:
System.ArgumentOutOfRangeException wurde nicht behandelt.
Message="Das angegebene Argument liegt außerhalb des gültigen" & _
"Wertebereichs.\r\nParametername: rowIndex"
Source="System.Windows.Forms"
ParamName="rowIndex"
StackTrace:
bei System.Windows.Forms.DataGridView.GetCellDisplayRectangle(Int32 _
columnIndex, Int32 rowIndex, Boolean cutOverflow)
bei System.Windows.Forms.DataGridView.GetCellAdjustedDisplayRectangle( _
Int32 columnIndex, Int32 rowIndex, Boolean cutOverflow)
bei System.Windows.Forms.DataGridView.InvalidateCellPrivate(Int32 _
columnIndex, Int32 rowIndex)
bei System.Windows.Forms.DataGridView.OnCellCommonChange(Int32 _
columnIndex, Int32 rowIndex)
bei _
System.Windows.Forms.DataGridView.DataGridViewDataConnection.ProcessList_
Changed(ListChangedEventArgs e)
bei _
System.Windows.Forms.DataGridView.DataGridViewDataConnection.currencyMan_
ager_ListChanged(Object sender, ListChangedEventArgs e)
bei System.Windows.Forms.CurrencyManager.OnListChanged( _
ListChangedEventArgs e)
bei System.Windows.Forms.CurrencyManager.CancelCurrentEdit()
bei _
System.Windows.Forms.DataGridView.DataGridViewDataConnection.CancelRow_
Edit(Boolean restoreRow, Boolean addNewFinished)
bei _
System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowValida_
ting(DataGridViewCellCancelEventArgs e)
bei System.Windows.Forms.DataGridView.OnRowValidating(DataGridViewCell& _
dataGridViewCell, Int32 columnIndex, Int32 rowIndex)
bei System.Windows.Forms.DataGridView.CommitEditForOperation(Int32 _
columnIndex, Int32 rowIndex, Boolean forCurrentCellChange)
bei System.Windows.Forms.DataGridView.ScrollIntoView(Int32 columnIndex, _
Int32 rowIndex, Boolean forCurrentCellChange)
bei System.Windows.Forms.DataGridView.ProcessUpKey(Keys keyData)
bei System.Windows.Forms.DataGridView.ProcessDataGridViewKey( _
KeyEventArgs e)
bei System.Windows.Forms.DataGridView.OnKeyDown(KeyEventArgs e)
bei System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
bei System.Windows.Forms.DataGridView.ProcessKeyEventArgs(Message& m)
bei System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
bei System.Windows.Forms.Control.WmKeyChar(Message& m)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.DataGridView.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(Int32 _
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(ApplicationContext context)
bei _
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase._
OnRun()
bei _
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Do_
ApplicationModel()
bei _
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Ru_
n(String[] commandLine)
bei PlanMaß.My.MyApplication.Main(String[] Args)
bei System.AppDomain._nExecuteAssembly(Assembly 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.Run(ExecutionContext _
executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart() Im DGV habe ich 1 Datensatz.
Beim 1.Verlassen sagt mir die Bindingsource einen Count = 2
Beim 2.Verlassen einen Count = 3
Alle Codeteile die ich beim Datensatzwechsel drin hatte waren schon auskommentiert, ich komme nicht drauf wie ich das handeln kann.
Könnt Ihr mir da weiterhelfen?
Gruß Christian
Danke für die Hilfe
Gruß Christian |