Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a datagridview. Every cell has a name written in it.
My requirement is :
If I click on a cell, the name in that cell should be fetched in a string.
I have no idea how to do it.
Kindly suggest.
Posted

1 solution

Try this
C#
private void your_dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{    
       string cell_value=your_dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();    
}

Regards..
 
Share this answer
 
v2

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