Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi Code Project,

I am trying to make a small VB.Net 2012 application which has a column in DataGridView with each row having a fixed width of editable text. I want to be able to show the user which character in the cell the cursor is currently on.

Through searching I found this:

http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/06d2692a-82fe-4201-8187-358c7f43df49

Embarrassingly I am still unsure how I should handle the mentioned KeyPress sub to get this information.

Any assistance is gratefully received!

Thanks.
Posted
Comments
Shahan Ayyub 6-May-13 16:12pm    
Currently I do not have some sample code but I guess DataGridView.HitTest fucntion can help you to start with this.
TnTinMn 6-May-13 19:30pm    
Could you please elaborate on exactly what you mean by “I want to be able to show the user which character in the cell the cursor is currently on.”?

You have referenced an article showing how to use the EditingControlShowing event that implies you want to do this while editing the cell, but at that point you would have the textbox caret to indicate position.

Or do you want some type of automatic highlightly of the character the mouse pointer is over when not in edit mode?
codetowns 7-May-13 3:29am    
Thanks for the replies. Well I fear you are both seeing my ignorance but I would like to do both if possible. I am unsure how to capture the textbox caret from the code I linked to and would also welcome any advice of how the character position could be captured without editing (with I guess some sort of mousemove event?).

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