DataGrid Question

  • Thread starter Thread starter CJ Taylor
  • Start date Start date
C

CJ Taylor

Alright, I cannot figure out what I'm doing wrong here.

As some of you know I've been stripping out C1 out of my current project,
and going back to native .NET controls.

However, on one of my grids I have the following code...


....


chargeRows = oCharges.GetOpenChargesByFamily(_iFamID, dtSearch)

Me.BindingContext(Me.DsTransactions1, "rltInvChg").SuspendBinding()

Me.DsTransactions1.rltInvChg.Rows.Clear()

Me.DsTransactions1.Merge(chargeRows)

Me.BindingContext(Me.DsTransactions1, "rltInvChg").ResumeBinding()

....



It works fine the first time through.. then the second time... I get this
exception...

No value at index -1.

at System.Windows.Forms.CurrencyManager.get_Item(Int32 index)

at System.Windows.Forms.CurrencyManager.get_Current()

at Assetta.ColumnStyles.LabelColumn.Paint(Graphics g, Rectangle bounds,
CurrencyManager source, Int32 rowNum, Brush backBrush, Brush foreBrush,
Boolean alignToRight)

at System.Windows.Forms.DataGridRelationshipRow.PaintCellContents(Graphics
g, Rectangle cellBounds, DataGridColumnStyle column, Brush backBr, Brush
foreBrush, Boolean alignToRight)

at System.Windows.Forms.DataGridRow.PaintData(Graphics g, Rectangle bounds,
Int32 firstVisibleColumn, Int32 columnCount, Boolean alignToRight)

at System.Windows.Forms.DataGridRelationshipRow.Paint(Graphics g, Rectangle
bounds, Rectangle trueRowBounds, Int32 firstVisibleColumn, Int32
numVisibleColumns, Boolean alignToRight)

at System.Windows.Forms.DataGrid.PaintRows(Graphics g, Rectangle&
boundingRect)

at System.Windows.Forms.DataGrid.PaintGrid(Graphics g, Rectangle gridBounds)

at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe)

at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)

at System.Windows.Forms.Control.WmPaint(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.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.ComponentManager.System.Windows.Forms.UnsafeNativeMetho
ds+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason,
Int32 pvLoopData)

at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)

at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)

at System.Windows.Forms.Application.DoEvents()



It doesn't matter taht it is Assetta, this happens with the grid no matter
what. What am I clearly missing here...



Thanks,

cJ
 
The problem with being an expert is that no one can answer 'your' questions
..

;-)

Cheers - OHM
 
Back
Top