Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > .NET Frameworks (точка нет фреймворки) > Windows Forms
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 19.04.2013, 13:13   #1
Glen
Форумчанин
 
Аватар для Glen
 
Регистрация: 09.02.2011
Сообщений: 150
По умолчанию NullReferenceException в System.Windows.Forms.DataGridView

У меня есть .NET 4.0 WinForms application. В нём есть Grid – объект System.Windows.Forms.DataGridView object

Внезапно я получил (невоспроизводимую!) ошибку NullReferenceException :


Цитата:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.DataGridView.U nwireEditingControlEvents()
at System.Windows.Forms.DataGridView.E ndEdit(DataGridViewDataErrorContext s context, DataGridViewValidateCellInternal validateCell, Boolean fireCellLeave, Boolean fireCellEnter, Boolean fireRowLeave, Boolean fireRowEnter, Boolean fireLeave, Boolean keepFocus, Boolean resetCurrentCell, Boolean resetAnchorCell)
at System.Windows.Forms.DataGridView.S etCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick)
at System.Windows.Forms.DataGridView.s et_CurrentCell(DataGridViewCell value)
at System.Windows.Forms.DataGridView.O nClearingRows()
at System.Windows.Forms.DataGridViewRo wCollection.ClearInternal(Boolean recreateNewRow)
at System.Windows.Forms.DataGridView.R efreshRows(Boolean scrollIntoView)
at System.Windows.Forms.DataGridView.D ataGridViewDataConnection.ProcessLi stChanged(ListChangedEventArgs e)
at System.Windows.Forms.DataGridView.D ataGridViewDataConnection.currencyM anager_ListChanged(Object sender, ListChangedEventArgs e)
at System.Windows.Forms.CurrencyManage r.OnListChanged(ListChangedEventArg s e)
at System.Windows.Forms.CurrencyManage r.List_ListChanged(Object sender, ListChangedEventArgs e)
at System.Windows.Forms.BindingSource. OnListChanged(ListChangedEventArgs e)
at System.Windows.Forms.BindingSource. InnerList_ListChanged(Object sender, ListChangedEventArgs e)
at System.ComponentModel.BindingList`1 .OnListChanged(ListChangedEventArgs e)
at System.ComponentModel.BindingList`1 .FireListChanged(ListChangedType type, Int32 index)
at System.ComponentModel.BindingList`1 .ClearItems()
at System.Collections.ObjectModel.Coll ection`1.Clear()
at <My Code>;
Этот <My Code> вызывает Clear в BindingList-derived списке. Этот BindingList-derived список, в своб очередь, использован в BindingSource объекте. А этот BindingSource объект является datasource для этого DataGridView.

Почему это случилось?
Почему это случилось только один раз и дальше не воспроизводится?.
Как этого можно избежать?
Glen вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Windows Forms С++ Aleks1994 Помощь студентам 2 04.04.2013 18:40
Гиперссылки в System.Windows.Forms.RichTextBox Bubaleh Общие вопросы .NET 1 16.12.2012 16:22
Windows Forms masashama Windows Forms 12 14.02.2011 16:14
Обработка System.NullReferenceException ROD Visual C++ 2 23.06.2010 13:05
windows.forms *stRong* Помощь студентам 0 04.06.2010 04:39