locked
DataGridView (WinForms) - cell not going into edit mode on accented characters RRS feed

  • Question

  • Hello All,

    I noticed, that DataGridView is not going into edit mode when first character pressed is accented/special character on some national keyboards (eg. Polish). The thing is that on these keyboards right alt is used as AltGr, which is combination of ctrl+alt and has different use than standard (left) alt. On the US/international keyboard - both alts send the same code and system message (WM_SYSKEYDOWN), however the keyboards with AltGr send WM_KEYDOWN for right alt, and WM_SYSKEYDOWN for the left alt, plus some additional flags.

    The outcome is:

    • when cell in DGV is selected and we press any "standard" character - it goes into edit mode and character is displayed in the cell (a b c D 1 2 3....)
    • when accented/special character is pressed (eg. ś, Ś, ż...) - the cell doesn't go into edit mode, thus nothing is entered in the cell

    Possible workarounds:

    1. switching editmode of DGV to Enter/F2 - I don't want/can't
    2. writing own onkeypress handler that will handle special characters
    3. inheriting the DGV class and overriding methods/functions like processcmdkey, isinputchar, isinputkey, etc and dealing with system messages (WM_...)

    Questions:

    1. is there any way to have it fixed in .net (winforms, no idea how it works in WPF)?
    2. is it a bug or natural behavior, should/can it be reported as a bug?

    Sunday, March 5, 2017 9:57 PM

All replies

  • Hi yaqq,

    Like your title mentioned, your case more related to Winfrom, I will help move your case to winfrom forum for better support.

    Best regards,

    Kristin


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 6, 2017 6:14 AM
  • Hi,

    Sorry for my late reply.

    >>is there any way to have it fixed in .net (winforms, no idea how it works in WPF)?

    I can not find similar threads about your question, this problem has not been reported to us in the past. I think it can be done if you can catch the key code of accented/special character.

    >> is it a bug or natural behavior, should/can it be reported as a bug ?

    I guess this is because Microsoft treats those special characters as function keys not the standard char key. Considering each country's various keyboards may be impractical, and what we can do is following the standards.We can only hope that Microsoft in the near future be able to take this into account.

    Best Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Bob Ding Monday, March 13, 2017 5:50 AM
    Wednesday, March 8, 2017 10:14 AM