0
我在學習Windows Visual C#
所以我對此很陌生。我對細胞點擊事件此代碼爲我的DataGridViewDatagridView單元格在可視c中點擊事件#
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
con. ID = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
txtname.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
txtlname.Text = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
}
的問題是:我甚至有多少次點擊我的DataGridView這不是我的射擊斷點。如何解決這個問題?
你確定你是在網格中點擊你的細胞?因爲你的代碼看起來很好。 –
您是否添加了事件處理程序? https://msdn.microsoft.com/en-us/library/dd553231.aspx它可能會更容易在VB.Net中嘗試它,直到你習慣了事件處理程序 – Slai
@MAdeelKhalid是的我相信。在我點擊我的DataGridView之後,我希望數據在文本框中顯示。 – KiRa