Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can't find the CellClick event in the GridView properties in visual studio why?

What I have tried:

I have tried to write the event manually as the following

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs
{
int i = 0;
i= Convert.ToInt32(dataGridView1.SelectedCells[0].ToString());
MessageBox.Show("" + i);
}
but I got this error:
Severity	Code	Description	Project	File	Line	Suppression State
Error	CS1061	'view_books' does not contain a definition for 'dataGridView1_CellContentClick' and no extension method 'dataGridView1_CellContentClick' accepting a first argument of type 'view_books' could be found (are you missing a using directive or an assembly reference?)	Library	C:\Users\sd\Desktop\Library\Library\view_books.Designer.cs	54	Active
Posted
Updated 20-Dec-17 9:03am
v2
Comments
j snooze 20-Dec-17 17:18pm    
is this a winform or a webform?
hussein hammoud1990 24-Dec-17 16:05pm    
it is windows form
Sinisa Hajnal 21-Dec-17 8:20am    
Seconded! There are differences between DataGridView (win form) and DataGrid (web form), you cannot just copy/paste the code.
hussein hammoud1990 24-Dec-17 16:05pm    
thank you for your information

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