Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
private void DataGridView_SelectionChanged(object sender, EventArgs e)
{
foreach (DataGridViewRow row in DataGridView.SelectedRows)
{
string surname = row.Cells[0].Value.ToString();
string name = row.Cells[1].Value.ToString();
string mobile1Tel = row.Cells[2].Value.ToString();
.
.
.
.
txtSurname.Text = surname;
txtName.Text = name;
txtMobile1Tel.Text = mobile1Tel;
.
.
.
.
}
}

What I have tried:

Get to an array all row.Cells and then set it's to txt's boxes
Posted
Updated 22-Oct-18 7:12am
Comments
Patrice T 21-Oct-18 17:20pm    
And you have a question ?
[no name] 21-Oct-18 17:36pm    
Dito

1 solution

From the code it appears that the last row will be the values you see in you text box. unless of course you have an array of text boxes in that case.....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900