0
任何一個可以告訴我我做了什麼錯誤的代碼,它產生味精dataGridView_CellContentClick:調用或BeginInvoke不能在控制被稱爲
「調用或BeginInvoke無法控制被調用,直到窗口句柄已創建「
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == buyColumn.Index)
{
double openprice = (double)dataGridView.Rows[e.RowIndex].Cells[offerColumn.Index].Value;
string symbol = dataGridView.Rows[e.RowIndex].Cells[symbolColumn.Index].Value.ToString();
double quanity= (double)dataGridView.Rows[e.RowIndex].Cells[quanityColumn.Index].Value;
MessageBox.Show("I buy " + symbol + " with " + quanity + " at " + openprice);
}
更新:調試後,這3條線路引起的問題,PLZ告訴我如何解決
double openprice = (double)dataGridView.Rows[e.RowIndex].Cells[offerColumn.Index].Value;
string symbol = dataGridView.Rows[e.RowIndex].Cells[symbolColumn.Index].Value.ToString();
double quanity= (double)dataGridView.Rows[e.RowIndex].Cells[quanityColumn.Index].Value;
不可能出現的開始/調用符號不應該發生在Click事件上。發佈異常的堆棧跟蹤。 – 2011-03-01 02:59:00