Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
Exception when Grid is drawn with DataSource
posted

Hello Team Infragistics,

I recently messed around with our companys way to use the UltraWinGrid.

In the past we did everything sequential...which is stupid as we provide a very bad user experience when using our software.

For example, we got a DataSource from our MSSQL Database which had about 3k entries and was retrieved via a pretty confusing (and tehrefore slow) view on the datbase. So, this would lock up the whole software and once the complete data was retrieved the UltraWinGrids DataSource was filled.

I changed this a little and am now using a delegate to get the DataSource in another thread. Once the thread is done I retrieve the data and assign it to the DataSource as usual.

Here is a small snippet on how we fill the DataSource:

    Me.m_Grid.BeginUpdate()
    Me.m_Grid.SuspendRowSynchronization()
 
    Me.m_Grid.DataSource = m_AsyncDataSource
 
    Me.m_Grid.ResumeRowSynchronization()
    Me.m_Grid.EndUpdate()

Now, what happens with my asynchronus attempt is that I get an exception when I
resize the software window while the DataSource is assigned.

I tried searching for the problem....but it seems to be a inner exception which I can't really solve.

Here's the exception:

System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
   bei Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)
   bei Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   bei Infragistics.Win.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   bei Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
   bei Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(PaintEventArgs pe)
   bei System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   bei System.Windows.Forms.Control.WmPaint(Message& m)
   bei System.Windows.Forms.Control.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Is there anything I missed?

I hope you can help me out here

TL;DR

1. Have a UltraWinGrid filled with a DataSource thatwas retrieved asynchronus

2. Resize the Program (and therefore the drawn area of the grid) while the DataSource of the Grid is filled and get above exception

I hope you can help me out here.

Thanks in advance