Code that I have so far is below. I want to get the data from the first column of whatever row is selected at the time.
private void btnGetCustomerID_Click(object sender, EventArgs e)
{
String customerID;
int rowInd = 0;
rowInd = dgCustomers.CurrentCell.RowIndex;
customerID = //NOT SURE WHAT TO PUT HERE
txtCustomerID.Text = customerID;
}
您可以使用单元格集合,
object firstColumnValue=dgCustomers.CurrentCell.Cells[0].Value;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.