dataGrid显示问题

YJ123 2003-06-04 12:05:43
我用一个dataGrid绑定了一dataTable(“考生记录”)然后用多个连接线程在dataTable中查找修改数据(用Rows.Find("...")函数格式查找到要修改的行),每个线程只修改对应的一行数据.出现线程正常工作一段时间后(实时修改数据表中记录如“考试剩余时间”)出错,说未将对象设置到对象的实例,dataGrid出错一
大红叉,但dataTable中的数据能够正常更新,有一保存线程也能正常保存已考的成绩,我实在没招了,请帮帮忙提示一下,感谢!!!(出错信息如下)

有关调用实时 (JIT) 调试而不是此对话框的详细信息,
请参阅此消息的结尾。

************** 异常文本 **************
System.NullReferenceException: 未将对象引用设置到对象的实例。
at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)
at System.Windows.Forms.DataGridColumnStyle.GetColumnValueAtRow(CurrencyManager source, Int32 rowNum)
at System.Windows.Forms.DataGridTextBoxColumn.Paint(Graphics g, Rectangle bounds, CurrencyManager source, Int32 rowNum, Brush backBrush, Brush foreBrush, Boolean alignToRight)
at System.Windows.Forms.DataGridRelationshipRow.PaintCellContents(Graphics g, Rectangle cellBounds, DataGridColumnStyle column, Brush backBr, Brush foreBrush, Boolean alignToRight)
at System.Windows.Forms.DataGridRow.PaintData(Graphics g, Rectangle bounds, Int32 firstVisibleColumn, Int32 columnCount, Boolean alignToRight)
at System.Windows.Forms.DataGridRelationshipRow.Paint(Graphics g, Rectangle bounds, Rectangle trueRowBounds, Int32 firstVisibleColumn, Int32 numVisibleColumns, Boolean alignToRight)
at System.Windows.Forms.DataGrid.PaintRows(Graphics g, Rectangle& boundingRect)
at System.Windows.Forms.DataGrid.PaintGrid(Graphics g, Rectangle gridBounds)
at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
...全文
64 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuziling32 2003-06-04
  • 打赏
  • 举报
回复
Rows.Find(表中的主健)
YJ123 2003-06-04
  • 打赏
  • 举报
回复
出错时我已有代码将要查的字段(如考号)设为了主键!请继续帮忙!!!

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧