with the appropriate columns and use it for the DataGrids.DataS ource.
Later on in my app, I alter the DataTable:
dt.BeginLoadDat a();
for(int i = 0; i < _movesArrayList .Count; i++)
{
string[] columnValues = ((string)_moves ArrayList[i]).Split(COL_SEP ARATOR);
DataRow _moveRow = dt.NewRow();
_moveRow[0] = columnValues[0];
_moveRow[1] = columnValues[1];
_moveRow[2] = columnValues[2];
dt.Rows.Add(_mo veRow);
}
dt.EndLoadData( );
The thing is, every once in a while my app crashes and I get the following
error:
A first chance exception of type 'System.NullRef erenceException ' occurred in
system.windows. forms.dll
Additional information: Object reference not set to an instance of an object.
According to the stack trace it occurs at dt.EndLoadData( ) and in the method
System.Windows. Forms.DataGridT oolTip::CreateT oolTipHandle()
I can't reliably reproduce it. Has anyone seen anyhting like this before?
Thanks.
Following is the stack trace:
system.windows. forms.dll!Syste m.Windows.Forms .DataGridToolTi p::CreateToolTi pHandle() + 0x160 bytes
system.windows. forms.dll!Syste m.Windows.Forms .DataGrid::Rese tToolTip() +
0x44 bytes
system.windows. forms.dll!Syste m.Windows.Forms .DataGrid::OnLa yout(System.Win dows.Forms.Layo utEventArgs
levent = {System.Windows .Forms.LayoutEv entArgs}) + 0xa7 bytes
system.windows. forms.dll!Syste m.Windows.Forms .Control::Perfo rmLayout(System .Windows.Forms. Control
affectedControl = null, String* affectedPropert y = null) + 0x7b bytes
system.windows. forms.dll!Syste m.Windows.Forms .Control::Perfo rmLayout() +
0x13 bytes
system.windows. forms.dll!Syste m.Windows.Forms .DataGrid::Rese tUIState() +
0x34 bytes
system.windows. forms.dll!Syste m.Windows.Forms .DataGrid::SetD ataGridRows(Sys tem.Windows.For ms.DataGridRow[]
newRows = null, __int32 newRowsLength = 212) + 0x7e bytes
system.windows. forms.dll!Syste m.Windows.Forms .DataGrid::Recr eateDataGridRow s() + 0x5e bytes
system.windows. forms.dll!Syste m.Windows.Forms .DataGrid::Data Source_Changed( System.Object
sender = {System.Windows .Forms.Currency Manager}, System.EventArg s ea =
{System.EventAr gs}) + 0x143 bytes
system.windows. forms.dll!Syste m.Windows.Forms .DataGrid::Data Source_ItemChan ged(System.Obje ct
sender = {System.Windows .Forms.Currency Manager},
System.Windows. Forms.ItemChang edEventArgs ea = {Index=-1}) + 0x3d bytes
system.windows. forms.dll!Syste m.Windows.Forms .CurrencyManage r::OnItemChange d(System.Window s.Forms.ItemCha ngedEventArgs e = {Index=-1}) + 0xa4 bytes
system.windows. forms.dll!Syste m.Windows.Forms .CurrencyManage r::UpdateIsBind ing(bool force = false) + 0x12d bytes
system.windows. forms.dll!Syste m.Windows.Forms .CurrencyManage r::UpdateIsBind ing() + 0x11 bytes
system.windows. forms.dll!Syste m.Windows.Forms .CurrencyManage r::List_ListCha nged(System.Obj ect
sender = {System.Data.Da taView}, System.Componen tModel.ListChan gedEventArgs e
= {System.Compone ntModel.ListCha ngedEventArgs}) + 0x159 bytes
system.data.dll !System.Data.Da taView::OnListC hanged(System.C omponentModel.L istChangedEvent Args
e = {System.Compone ntModel.ListCha ngedEventArgs}) + 0x48 bytes
system.data.dll !System.Data.Da taView::IndexLi stChanged(Syste m.Object sender
= {System.Data.In dex}, System.Componen tModel.ListChan gedEventArgs e =
{System.Compone ntModel.ListCha ngedEventArgs}) + 0x43 bytes
system.data.dll !System.Data.Da taView::FireEve nt(System.Data. TargetEvent
targetEvent = IndexListChange d, System.Object sender = {System.Data.In dex},
System.EventArg s e = {System.Compone ntModel.ListCha ngedEventArgs}) + 0x4c
bytes
system.data.dll !System.Data.Da taViewListener: :IndexListChang ed(System.Objec t
sender = {System.Data.In dex}, System.Componen tModel.ListChan gedEventArgs e =
{System.Compone ntModel.ListCha ngedEventArgs}) + 0x3d bytes
system.data.dll !System.Data.In dex::OnListChan ged(System.Comp onentModel.List ChangedEventArg s e = {System.Compone ntModel.ListCha ngedEventArgs}) + 0x29 bytes
system.data.dll !System.Data.In dex::Reset() + 0x1c bytes
system.data.dll !System.Data.Da taTable::EndLoa dData() + 0xc1 bytes
FloorsTest.exe !FloorsTest.Maz e.FillResultsDa taGrid() Line 805 C#