當前位置:成語大全網 - 書法字典 - 如何在C#編寫的界面中顯示dataGridView1中的內容?

如何在C#編寫的界面中顯示dataGridView1中的內容?

dataGridView1控件有壹個行單擊事件。妳右擊dataGridView1屬性,然後找到row事件,然後妳就可以獲取行中的行數據,並把它賦給妳對應的textbox。

以下代碼:

私人?作廢?datagridview 1 _ cell click(object?發件人?DataGridViewCellEventArgs?e)

{

如果?(this.dataGridView1。選擇行?!=?null?& amp& amp?this.dataGridView1。選擇行。計數?& gt?0)

{

this . txt name . text = this . datagridview 1。選擇行[0]。cells[1]. value . tostring();

//其他文本框等等,只是改變單元格的索引值。

}

}