真的,我不知道我的做法是否以編程方式是正確的,所以我希望指出我。
我有一個顯示來自鏈接MySQL數據庫和一些輸入框數據的DataGridView C#來幫助數據插入到數據庫中,一切都還好,但是當我決定做一個單獨的新線程插入操作我做了以下內部添加按鈕:DataGridView在新線程內的默認錯誤
private void AddToolStripMenuItem_Click(object sender, EventArgs e){
try{
new thread(() =>{
// insertion code goes here
//to update DataGridView after inserting
this.studentinfoTableAdapter.Fill(this.schoolDataSet.studentinfo);
}).start();
}catch(exception ex){...}
}
所以後來一個新的對話框錯誤是彈出式在每一個新的插入操作並沒有什麼保存,這裏是錯誤:
我想在this.studentinfoTableAdapter.Fill(this.schoolDataSet.studentinfo);
衝突的可能造成的this
錯誤我確實糾正了它,但錯誤仍然存在。
任何建議可以幫助我,並讚賞。
調試你的代碼。看看你得到這個錯誤的地方。閱讀[什麼是IndexOutOfRangeException,如何解決它?](http://stackoverflow.com/questions/20940979/what-is-indexoutofrangeexception-and-how-do-i-fix-it)並解決它。 –
我做了debuged錯誤顯示時,達到'this.studentinfoTableAdapter.Fill(this.schoolDataSet.studentinfo);'線爲什麼我認爲這'衝突,但沒有幫助 – wisdom