0
我遇到了問題,我一直在搜索幾個小時,但沒有運氣。在Cellcontent點擊後將數據行加載到文本框中
我想達到的是以下幾點。點擊datagridview
中的一個單元格後,我需要另一個選項卡來顯示並將行(客戶號碼支付金額等數據)加載到幾個textboxes
。任何人都有這個功能的一些例子或一些很好的建議?
我遇到了問題,我一直在搜索幾個小時,但沒有運氣。在Cellcontent點擊後將數據行加載到文本框中
我想達到的是以下幾點。點擊datagridview
中的一個單元格後,我需要另一個選項卡來顯示並將行(客戶號碼支付金額等數據)加載到幾個textboxes
。任何人都有這個功能的一些例子或一些很好的建議?
根據您的信息表明下一個方法:
創建datagridview的事件CellDoubleClick
事件處理程序(想使用的DoubleClick - 你可以使用你想要的)
this.datagridview1.CellDoubleClick += dataGridView1_CellDoubleClick;
然後創建一個加功能
void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
//here we write code for copying rowdata in your textboxes
DataGridViewRow dgvr = this.dataGridView1.CurrentRow;
//if datagridview have a predefined columns then using those objects as:
this.textboxCustomer.text = dgvr.Cells[this.datagridview1_ColCustomer.Name].Value.ToString();
this.textboxPay.text = dgvr.Cells[this.datagridview1_ColPay.Name].Value.ToString();
}
謝謝,作品像一個魅力。 – 2013-02-25 10:25:28