Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have taken over an application which uses the property grid. There are a couple of text properties which when I use the left and right arrow keys, instead of moving the text cursor left and right, moves focus to the previous / next property.

I have tried handling the KeyPress, KeyDown etc events but apparently these aren't implemented by microsoft. More accurately the key events from the PropertyGrids internal grid are not exposed publicly.

I have also tried creating an internal class TextEditor : UITypeEditor in order to provide my own text box but I am unsure how to get this to work. In particular the UITypeEditorStyle enum has three values none of which seem appropriate for an in-grid TextBox. There are lots of examples of doing this with dropdown lists and popup forms but not in-grid Textboxes.

All I really want is to allow the users to move the cursor left and right in the Property Grid text properties.

Anyone have any suggestions?
Posted
Updated 10-Feb-10 5:30am
v2

1 solution

Hi, I haven't details about your problem but use this method for texteditor in keydown events like this:
C#
if(e.KeyCode == Keys.Right)
    this.SelectNextControl(Txt_Price, true, true, true, true);

For customcontrol use ParentForm for this:
C#
if(e.KeyCode == Keys.Right)
    ParentForm.SelectNextControl(object, true, true, true, true);

Don't forget to sort tabstop property.
:thumbsup:
Persian boy
:rose:
 
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