将数据从datagridview显示到文本框

时间:2014-08-11 06:42:45

标签: c# datagridview

if (e.RowIndex >= 0)
{
    //gets a collection that contains all the rows
    DataGridViewRow row = this.tbl_deliveryDataGridView.Rows[e.RowIndex];

    //populate the textbox from specific value of the coordinates of column and row. 
    noTextBox.Text = row.Cells[0].Value.ToString();
    supplierTextBox.Text = row.Cells[1].Value.ToString();
    invoiceNumberTextBox.Text = row.Cells[2].Value.ToString();
    dRNumberTextBox.Text = row.Cells[3].Value.ToString();
    pONumberTextBox.Text = row.Cells[4].Value.ToString();
}

是否可以将括号内的数字更改为列名?怎么样?

0 个答案:

没有答案