我想忽略 C# DataGridview 中的错误警报

I want to ignore error alerts in C# DataGridview

提问人:Go Green 提问时间:9/21/2023 更新时间:9/21/2023 访问量:47

问:

我正在使用 C# DatagridView,但出现此错误。

这是日志

Consulte o final desta mensagem para obter detalhes sobre como chamar a 
depuração just-in-time (JIT) em vez desta caixa de diálogo.

************** Texto de Exceção **************
System.NullReferenceException: Referência de objeto não definida para uma instância de um objeto.
   em System.Windows.Forms.DataGridViewRow.GetErrorText(Int32 rowIndex)
   em System.Windows.Forms.DataGridViewRow.Paint(Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, Int32 rowIndex, DataGridViewElementStates rowState, Boolean isFirstDisplayedRow, Boolean isLastVisibleRow)
   em System.Windows.Forms.DataGridView.PaintRows(Graphics g, Rectangle boundingRect, Rectangle clipRect, Boolean singleHorizontalBorderAdded)
   em System.Windows.Forms.DataGridView.PaintGrid(Graphics g, Rectangle gridBounds, Rectangle clipRect, Boolean singleVerticalBorderAdded, Boolean singleHorizontalBorderAdded)
   em System.Windows.Forms.DataGridView.OnPaint(PaintEventArgs e)
   em System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   em System.Windows.Forms.Control.WmPaint(Message& m)
   em System.Windows.Forms.Control.WndProc(Message& m)
   em System.Windows.Forms.DataGridView.WndProc(Message& m)
   em System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   em System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   em System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

我想忽略此错误,因为它们显示错误警报。 我该如何解决?

.NET C#-4.0

评论

0赞 dr.null 9/22/2023
你应该修复而不是忽略。使用调试器在网格的事件中查找您尝试访问的对象。null
0赞 Go Green 9/22/2023
我只想在那部分添加 try-catch .
0赞 dr.null 9/22/2023
_I只想在那部分添加 try-catch_ 哪个是?我们需要看到它。编辑并发布相关代码。

答: 暂无答案