Click here to Skip to main content
15,903,849 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When the user click on a selected cell in the datagridview,i need that selected cell value and be able to draw it onto the picturebox.Any idea how this can be done?
Posted
Comments
CodeBlack 7-Nov-13 4:07am    
can you explain more with examples about what exactly you want to do ?

X = dataGridView1[Column,Row].Value;

get value from selected rows in datagridview[^]
 
Share this answer
 
This event occurs when any part of a cell is clicked, including borders and padding. It also occurs when the user presses and releases the SPACE key while a button cell or check box cell has focus, and will occur twice for these cell types if the cell is clicked while pressing the SPACE key.

C#
private void dataGridView1_CellClick(object sender,
    DataGridViewCellEventArgs e)
{
  if (dataGridView1.CurrentCell.ColumnIndex.Equals(3) && e.RowIndex != -1){
        if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.Value != null)
            MessageBox.Show(dataGridView1.CurrentCell.Value.ToString());   
   
}
 
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