请教各位前辈:
以下是一段错误记录,请问我怎么才知道问题出在哪.如果这些信息不足以找出问题点的话,我还需要记录哪些信息?谢谢!电脑名称:E*****
用户名称:R*****\u***
IP地址:192.168.1.*
物理内存:519553024
发生时间2009-1-6 16:34:23:
错误信息:指定的参数已超出有效值的范围。
参数名: rowIndex
类名:DataGridView
方法名:GetCellDisplayRectangle
StackTrace: 在 System.Windows.Forms.DataGridView.GetCellDisplayRectangle(Int32 columnIndex, Int32 rowIndex, Boolean cutOverflow)
在 System.Windows.Forms.DataGridView.GetCellAdjustedDisplayRectangle(Int32 columnIndex, Int32 rowIndex, Boolean cutOverflow)
在 System.Windows.Forms.DataGridView.InvalidateCellPrivate(Int32 columnIndex, Int32 rowIndex)
在 System.Windows.Forms.DataGridView.OnCellCommonChange(Int32 columnIndex, Int32 rowIndex)
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.ProcessListChanged(ListChangedEventArgs e)
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.currencyManager_ListChanged(Object sender, ListChangedEventArgs e)
在 System.Windows.Forms.CurrencyManager.OnListChanged(ListChangedEventArgs e)
在 System.Windows.Forms.CurrencyManager.CancelCurrentEdit()
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.CancelRowEdit(Boolean restoreRow, Boolean addNewFinished)
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowValidating(DataGridViewCellCancelEventArgs e)
在 System.Windows.Forms.DataGridView.OnRowValidating(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex)
在 System.Windows.Forms.DataGridView.OnValidating(CancelEventArgs e)
在 System.Windows.Forms.Control.PerformControlValidation(Boolean bulkValidation)
在 System.Windows.Forms.ContainerControl.ValidateThroughAncestor(Control ancestorControl, Boolean preventFocusChangeOnError)
在 System.Windows.Forms.ContainerControl.ValidateInternal(Boolean checkAutoValidate, Boolean& validatedControlAllowsFocusChange)
在 System.Windows.Forms.ContainerControl.ValidateInternal(Boolean checkAutoValidate, Boolean& validatedControlAllowsFocusChange)
在 System.Windows.Forms.ContainerControl.Validate(Boolean checkAutoValidate)
在 System.Windows.Forms.Form.WmClose(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
以下是一段错误记录,请问我怎么才知道问题出在哪.如果这些信息不足以找出问题点的话,我还需要记录哪些信息?谢谢!电脑名称:E*****
用户名称:R*****\u***
IP地址:192.168.1.*
物理内存:519553024
发生时间2009-1-6 16:34:23:
错误信息:指定的参数已超出有效值的范围。
参数名: rowIndex
类名:DataGridView
方法名:GetCellDisplayRectangle
StackTrace: 在 System.Windows.Forms.DataGridView.GetCellDisplayRectangle(Int32 columnIndex, Int32 rowIndex, Boolean cutOverflow)
在 System.Windows.Forms.DataGridView.GetCellAdjustedDisplayRectangle(Int32 columnIndex, Int32 rowIndex, Boolean cutOverflow)
在 System.Windows.Forms.DataGridView.InvalidateCellPrivate(Int32 columnIndex, Int32 rowIndex)
在 System.Windows.Forms.DataGridView.OnCellCommonChange(Int32 columnIndex, Int32 rowIndex)
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.ProcessListChanged(ListChangedEventArgs e)
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.currencyManager_ListChanged(Object sender, ListChangedEventArgs e)
在 System.Windows.Forms.CurrencyManager.OnListChanged(ListChangedEventArgs e)
在 System.Windows.Forms.CurrencyManager.CancelCurrentEdit()
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.CancelRowEdit(Boolean restoreRow, Boolean addNewFinished)
在 System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowValidating(DataGridViewCellCancelEventArgs e)
在 System.Windows.Forms.DataGridView.OnRowValidating(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex)
在 System.Windows.Forms.DataGridView.OnValidating(CancelEventArgs e)
在 System.Windows.Forms.Control.PerformControlValidation(Boolean bulkValidation)
在 System.Windows.Forms.ContainerControl.ValidateThroughAncestor(Control ancestorControl, Boolean preventFocusChangeOnError)
在 System.Windows.Forms.ContainerControl.ValidateInternal(Boolean checkAutoValidate, Boolean& validatedControlAllowsFocusChange)
在 System.Windows.Forms.ContainerControl.ValidateInternal(Boolean checkAutoValidate, Boolean& validatedControlAllowsFocusChange)
在 System.Windows.Forms.ContainerControl.Validate(Boolean checkAutoValidate)
在 System.Windows.Forms.Form.WmClose(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
解决方案 »
- .NET Frameword 3.5下c#的默认参数(Optional, DefaultParameterValue)的问题
- 用户控件 dropdownlist + textbox 疑问
- 帮忙看看,C#接收广播包的性能问题(小弟感激不尽啊)
- C#中的string类型的容量问题`
- c# 简单问题,listview单击,如何知道点击的是第几列?
- C#操作移动菜单形XML的节点(求大神出来指导迷津) 急!!!
- 如何让自己的应用程序只被执行一次??请指教!!!
- 一个PictureBox的问题,大家帮帮忙!
- 如何生成类似于WINDOWS资源管理器的框架窗体?
- 滚动新闻是如何实现的
- 求 大侠 给个可以检测服务器是否被攻击的办法
- 为什么 sql 连接超时 IIS 就死 怎么解决!!
-or-
rowIndex is less than -1 or greater than the number of rows in the control minus 1.
分析一下,代码里调用的行或者列越界了
-or-
rowIndex is less than -1 or greater than the number of rows in the control minus 1. 分析一下,代码里调用的行或者列越界了
窗口关闭的时候,DataGridView关闭或者析构的时候发生错误,具体类型是参数错误
你看一下有没有InternalException估计是你的DataGridView有问题,比如在还没有完全打开的时候就关闭....或者正在进行某些操作啊,后者某些东西没有初始化完成...等等 都有可能
参数名: rowIndex 看堆栈似乎是修改某行的时候关闭窗口出错,找找代码中操作DataGridView的地方
http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/ec08d0b4-5779-49b3-ae8a-40d064e79374/
参数名: rowIndex
类名:DataGridView
方法名:GetCellDisplayRectangle 写的很清楚.
多次点击, 行来回切换, 就报那个错误, 错误堆栈跟你的, 那个帖子的完全一样
分析一下这段看, 窗体放置 DataGridView 默认属性
public partial class Form1 : Form
{
DataTable dt = null;
public Form1()
{
InitializeComponent();
} protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
CreateTable();
dataGridView1.DataSource = dt;
dataGridView1.CellLeave+=new DataGridViewCellEventHandler(dataGridView1_CellLeave);
} void CreateTable()
{
dt = new DataTable();
dt.Columns.Add("a");
dt.Columns.Add("b");
dt.Columns.Add("c");
dt.Columns.Add("d");
} void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
if (this.dataGridView1.Columns[e.ColumnIndex].Name.ToUpper() == "b".ToUpper())
{
dataGridView1[e.ColumnIndex, e.RowIndex].Value += "c";
}
}
System.InvalidOperationException: Operation is not valid due to the current state of the object.
也是來回點擊時報的錯
如果是的话,该怎么解决呢?
打.NET补丁吗?