C# 给datagridview赋值有时会报错:Specified argument was out of the range of valid values
System.ArgumentOutOfRangeException:Specifiedargumentwasoutoftherangeofvalidvalues.Par...
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: e.RowIndex
at System.Windows.Forms.DataGridView.OnCellFormatting(DataGridViewCellFormattingEventArgs e)
at System.Windows.Forms.DataGridView.OnCellFormatting(Int32 columnIndex, Int32 rowIndex, Object val, Type formattedValueType, DataGridViewCellStyle cellStyle)
at System.Windows.Forms.DataGridViewCell.GetFormattedValue(Object value, Int32 rowIndex, DataGridViewCellStyle& cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
at System.Windows.Forms.DataGridViewCell.GetFormattedValue(Int32 rowIndex, DataGridViewCellStyle& cellStyle, DataGridViewDataErrorContexts context)
at System.Windows.Forms.DataGridViewTextBoxCell.GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, Int32 rowIndex, Size constraintSize)
at System.Windows.Forms.DataGridViewCell.GetPreferredHeight(Int32 rowIndex, Int32 width)
at System.Windows.Forms.DataGridViewCell.OnCellDataAreaMouseEnterInternal(Int32 rowIndex)
at System.Windows.Forms.DataGridViewCell.OnMouseMoveInternal(DataGridViewCellMouseEventArgs e)
at System.Windows.Forms.DataGridView.OnCellMouseMove(DataGridViewCellMouseEventArgs e)
at System.Windows.Forms.DataGridView.UpdateMouseEnteredCell(HitTestInfo hti, MouseEventArgs e) 展开
Parameter name: e.RowIndex
at System.Windows.Forms.DataGridView.OnCellFormatting(DataGridViewCellFormattingEventArgs e)
at System.Windows.Forms.DataGridView.OnCellFormatting(Int32 columnIndex, Int32 rowIndex, Object val, Type formattedValueType, DataGridViewCellStyle cellStyle)
at System.Windows.Forms.DataGridViewCell.GetFormattedValue(Object value, Int32 rowIndex, DataGridViewCellStyle& cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
at System.Windows.Forms.DataGridViewCell.GetFormattedValue(Int32 rowIndex, DataGridViewCellStyle& cellStyle, DataGridViewDataErrorContexts context)
at System.Windows.Forms.DataGridViewTextBoxCell.GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, Int32 rowIndex, Size constraintSize)
at System.Windows.Forms.DataGridViewCell.GetPreferredHeight(Int32 rowIndex, Int32 width)
at System.Windows.Forms.DataGridViewCell.OnCellDataAreaMouseEnterInternal(Int32 rowIndex)
at System.Windows.Forms.DataGridViewCell.OnMouseMoveInternal(DataGridViewCellMouseEventArgs e)
at System.Windows.Forms.DataGridView.OnCellMouseMove(DataGridViewCellMouseEventArgs e)
at System.Windows.Forms.DataGridView.UpdateMouseEnteredCell(HitTestInfo hti, MouseEventArgs e) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询