Anyone seen this? Know if its a bug? I'm pretty sure it is.
I have a DataGridView control in a tab control who's datasource is a
table in a dataset. In certain situations when I add a row to the
datasource table I get the following exception which seems to be a bad
reference inside the control itself.
Any ideas? Here's the exception:
Thanks.
Message: Object reference not set to an instance of an object.Stack: at
System.Windows.Forms.DataGridView.InvalidateScroll Bars() at
System.Windows.Forms.DataGridView.ResetUIState(Boo lean useRowShortcut,
Boolean computeVisibleRows) at
System.Windows.Forms.DataGridViewRowCollection.OnC ollectionChanged_PreNotification(CollectionChangeA ction
cca, Int32 rowIndex, Int32 rowCount, DataGridViewRow& dataGridViewRow,
Boolean changeIsInsertion) at
System.Windows.Forms.DataGridViewRowCollection.OnC ollectionChanged(CollectionChangeEventArgs
e, Int32 rowIndex, Int32 rowCount, Boolean changeIsDeletion, Boolean
changeIsInsertion, Boolean recreateNewRow, Point newCurrentCell) at
System.Windows.Forms.DataGridViewRowCollection.Ins ertInternal(Int32
rowIndex, DataGridViewRow dataGridViewRow, Boolean force) at
System.Windows.Forms.DataGridView.DataGridViewData Connection.ProcessListChanged(ListChangedEventArgs
e) at
System.Windows.Forms.DataGridView.DataGridViewData Connection.currencyManager_ListChanged(Object
sender, ListChangedEventArgs e) at
System.ComponentModel.ListChangedEventHandler.Invo ke(Object sender,
ListChangedEventArgs e) at
System.Windows.Forms.CurrencyManager.OnListChanged (ListChangedEventArgs
e) at System.Windows.Forms.CurrencyManager.List_ListChan ged(Object
sender, ListChangedEventArgs e) at
System.Windows.Forms.BindingSource.OnListChanged(L istChangedEventArgs
e) at System.Windows.Forms.BindingSource.InnerList_ListC hanged(Object
sender, ListChangedEventArgs e) at
System.Data.DataView.OnListChanged(ListChangedEven tArgs e) at
System.Data.DataView.IndexListChanged(Object sender,
ListChangedEventArgs e) at
System.Data.DataViewListener.IndexListChanged(Obje ct sender,
ListChangedEventArgs e) at
System.Data.Index.OnListChanged(ListChangedEventAr gs e) at
System.Data.Index.InsertRecord(Int32 record, Boolean fireEvent) at
System.Data.Index.ApplyChangeAction(Int32 record, Int32 action) at
System.Data.DataTable.RecordStateChanged(Int32 record1,
DataViewRowState oldState1, DataViewRowState newState1, Int32 record2,
DataViewRowState oldState2, DataViewRowState newState2) at
System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32
proposedRecord, DataRowAction action, Boolean isInMerge, Int32
position, Boolean fireEvent) at System.Data.DataTable.InsertRow(DataRow
row, Int32 proposedID, Int32 pos, Boolean fireEvent) at
System.Data.DataRowCollection.Add(DataRow row) at
Insurance.EmployeeFrm.NewDependant(Object sender,
LinkLabelLinkClickedEventArgs e) in C:\Documents and
Settings\csaloio\Desktop\Code\NET\Insurance\Insura nce\EmployeeFrm.cs:line
263 at
System.Windows.Forms.LinkLabel.OnLinkClicked(LinkL abelLinkClickedEventArgs
e) at System.Windows.Forms.LinkLabel.OnMouseUp(MouseEven tArgs e) at
System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button,
Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.Label.WndProc(Message& m) at
System.Windows.Forms.LinkLabel.WndProc(Message& msg) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg) at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData) at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.Run(Form mainForm) at
Insurance.Program.Main() in C:\Documents and