我有一個桌面應用程序,它顯示Datagridview中的數據,但點擊Datagridview的標題時顯示此錯誤: - 索引超出範圍。必須是非負數且小於集合的大小。 參數名稱:索引
自動選擇網格中的第一行爲什麼選擇自動選擇沒有排序發生。如何排序是可能的。請幫助我擺脫這個錯誤。我非常感謝你。點擊標題gridview
private void GV_investigate_CellClick(object sender, DataGridViewCellEventArgs e)
{
int oid = int.Parse(GV_investigate.SelectedRows[0].Cells[0].Value.ToString());
}
private void GV_investigate_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
GV_investigate.ClearSelection();
}
我們只能從這個猜想消息,但不能幫助你很多所以可以請分享你的代碼。 – Sachin 2013-03-15 22:04:23
請編輯您的問題與排序/標頭點擊觸發的代碼,當您在調試模式下重現此錯誤時,visual studio會顯示從代碼拋出的異常。 – 2013-03-15 22:07:56