Highlight event in Datagridview

Hans2047

New member
Joined
Jul 11, 2007
Messages
2
Programming Experience
Beginner
Hi ,

I have a datagridview with names in a grid 2 by 50.

I want to select 3 of the names and I can do this OK (and highlight each of the cells), but here's the problem:
When I mouse-click on the cell, away from the text, the cell gets highlighted in black but the event is not recognised by the code.

This occurs to the left, right, above and below the text.
On a short name, unless leading and trailing spaces are are added, a large area of the cell does not respond.

Of course if I click on the text itself everything works fine.

I have tried various methods to get this to work without success. I can not get a reaction to happen on the black highlight event.

Any clues?

Thanks
 
Problem solved

I got the answer from an MSDN Forum. (thanks Ben Rinaca)

I was using the CellContentClick event where I should have been using the CellClick event handler.
The ContentClick does only respond ,as the name suggests, to the text content.
Now it works perfectly.
 
Back
Top