ullfindsmit
asked on
[500] [URGENT] - A - vb.net winform datagrid dataset refresh timing
-------------------------- -
Object reference not set to an instance of an object.
-------------------------- -
at System.Data.DataView.GetRe cord(Int32 recordIndex)
at System.Data.DataView.IsOri ginalVersi on(Int32 index)
at System.Data.DataRowView.Ge tColumnVal ue(DataCol umn column)
at System.Data.DataColumnProp ertyDescri ptor.GetVa lue(Object component)
at System.Windows.Forms.DataG ridColumnS tyle.GetCo lumnValueA tRow(Curre ncyManager source, Int32 rowNum)
at System.Windows.Forms.DataG ridTextBox Column.Pai nt(Graphic s g, Rectangle bounds, CurrencyManager source, Int32 rowNum, Brush backBrush, Brush foreBrush, Boolean alignToRight)
at System.Windows.Forms.DataG ridRelatio nshipRow.P aintCellCo ntents(Gra phics g, Rectangle cellBounds, DataGridColumnStyle column, Brush backBr, Brush foreBrush, Boolean alignToRight)
at System.Windows.Forms.DataG ridRow.Pai ntData(Gra phics g, Rectangle bounds, Int32 firstVisibleColumn, Int32 columnCount, Boolean alignToRight)
at System.Windows.Forms.DataG ridRelatio nshipRow.P aint(Graph ics g, Rectangle bounds, Rectangle trueRowBounds, Int32 firstVisibleColumn, Int32 numVisibleColumns, Boolean alignToRight)
at System.Windows.Forms.DataG rid.PaintR ows(Graphi cs g, Rectangle& boundingRect)
at System.Windows.Forms.DataG rid.PaintG rid(Graphi cs g, Rectangle gridBounds)
at System.Windows.Forms.DataG rid.OnPain t(PaintEve ntArgs pe)
at System.Windows.Forms.Contr ol.PaintWi thErrorHan dling(Pain tEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Contr ol.WmPaint (Message& m)
at System.Windows.Forms.Contr ol.WndProc (Message& m)
at System.Windows.Forms.Contr olNativeWi ndow.OnMes sage(Messa ge& m)
at System.Windows.Forms.Contr olNativeWi ndow.WndPr oc(Message & m)
at System.Windows.Forms.Nativ eWindow.De buggableCa llback(Int Ptr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.Unsaf eNativeMet hods.Dispa tchMessage W(MSG& msg)
at System.Windows.Forms.Compo nentManage r.System.W indows.For ms.UnsafeN ativeMetho ds+IMsoCom ponentMana ger.FPushM essageLoop (Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Threa dContext.R unMessageL oopInner(I nt32 reason, ApplicationContext context)
at System.Windows.Forms.Threa dContext.R unMessageL oop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Appli cation.Run (Form mainForm)
at eBuilder.Apps.TransferMana gerApp.mod Main.main( ) in C:\VSS\TransferManager\Tra nsferManag erApplicat ion\modMai n.vb:line 45
-------------------------- -
OK
-------------------------- -
dvQueue = New DataView(modMain.objClsDST MW.dsTrans ferManager .transferM anagerFile , "fFileStatus<>'Success' and fFileStatus<>'Cancelled'", "fFilePriority ASC", DataViewRowState.CurrentRo ws)
dgQueue.DataSource = dvQueue
the datagrid is bound to a dataset's datatable and teh table is updated via another thread in the process... this causes the above exception... the thread updates the dataset at times may be 100 times a second.. so hwo do I work arround this.
I heard of the beginudpate endupdate event but unsuccessfull in finding how to implement it.
also how to show only a few columns necessary and how to change their header.
thanks
-smit.
pelase help
Object reference not set to an instance of an object.
--------------------------
at System.Data.DataView.GetRe
at System.Data.DataView.IsOri
at System.Data.DataRowView.Ge
at System.Data.DataColumnProp
at System.Windows.Forms.DataG
at System.Windows.Forms.DataG
at System.Windows.Forms.DataG
at System.Windows.Forms.DataG
at System.Windows.Forms.DataG
at System.Windows.Forms.DataG
at System.Windows.Forms.DataG
at System.Windows.Forms.DataG
at System.Windows.Forms.Contr
at System.Windows.Forms.Contr
at System.Windows.Forms.Contr
at System.Windows.Forms.Contr
at System.Windows.Forms.Contr
at System.Windows.Forms.Nativ
at System.Windows.Forms.Unsaf
at System.Windows.Forms.Compo
at System.Windows.Forms.Threa
at System.Windows.Forms.Threa
at System.Windows.Forms.Appli
at eBuilder.Apps.TransferMana
--------------------------
OK
--------------------------
dvQueue = New DataView(modMain.objClsDST
dgQueue.DataSource = dvQueue
the datagrid is bound to a dataset's datatable and teh table is updated via another thread in the process... this causes the above exception... the thread updates the dataset at times may be 100 times a second.. so hwo do I work arround this.
I heard of the beginudpate endupdate event but unsuccessfull in finding how to implement it.
also how to show only a few columns necessary and how to change their header.
thanks
-smit.
pelase help
ASKER
but it is not binding teh grid 100 times a second... remeber its a windows form...
does the code work if you dont do it 100 times a second?
Yes, I'm confused now as to whats running 100 times. If its not the code above what is it ?
You have a bug, its probably due to pressing teh keys in teh wrong order.
can you post the code of the thread you said you use to update the table? and in which part of your code do you call the thread, is it inside any event of the datagridview?
ASKER
alrit folks.... here's teh deal..
it was because of multiple threads I started fromt he TICK.
I got rid of that... now I have another problem... I get a BIG RED X on my DG when it updates.
I'll be looking it up online, if you can find it before I do... the points are yours.... else there will be a split for the effort.
-Smit.
it was because of multiple threads I started fromt he TICK.
I got rid of that... now I have another problem... I get a BIG RED X on my DG when it updates.
I'll be looking it up online, if you can find it before I do... the points are yours.... else there will be a split for the effort.
-Smit.
have you found it? post the complete code for the form, can you?
ASKER
there was no real fix for the problem.
Ended up decreasing the update speed on my datagrid by slowign down the process and Decreased the number of threads.
I did use this link http://www.sturmnet.org/blog/archives/2005/03/23/red-x/ as reference for some backup...
I'll leave the question open till I'm done with the project.
If anyone can find any solution I'd greatly appreciate it
Thanks
-smit
Ended up decreasing the update speed on my datagrid by slowign down the process and Decreased the number of threads.
I did use this link http://www.sturmnet.org/blog/archives/2005/03/23/red-x/ as reference for some backup...
I'll leave the question open till I'm done with the project.
If anyone can find any solution I'd greatly appreciate it
Thanks
-smit
ASKER
http://www.dotnet247.com/247reference/msgs/41/205926.aspx
is the solution.
thanks for your help though
is the solution.
thanks for your help though
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
100 times a second ?
It could be that the a thread is trying to run the code whilst already in use by another thread.
I would try locking the statment to see if it makes any difference.
ie ....
SyncLock Me
dvQueue = New DataView(modMain.objClsDST
dgQueue.DataSource = dvQueue
End SyncLock
Hope it helps !