none
which event handler to use to check value in a textbox once it is filled RRS feed

  • Question

  • hi,

    I am trying to create an event after the textbox gets filled with some value, I tried using previewtextinput but that's firing for every character entered. I want to check after the textbox gets filled, I don't have a button on the app either. Which event can I use for such behaviour.

    Wednesday, November 6, 2019 8:21 AM

Answers

  • Hi,

    end the input and press Enter

       private void TextBox_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.Key == Key.Enter)
                {
                    
                }
            }

    Best Regards,

    Alex


    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.

    • Marked as answer by cally_kalpana Wednesday, November 6, 2019 8:58 AM
    Wednesday, November 6, 2019 8:28 AM
    Moderator

All replies

  • Hi,
    you must define which event you want to try:

    ... I want to check after the textbox gets filled, I don't have a button on the app either. Which event can I use for such behaviour.

    You can use Keys.Enter, TextBox.Leave or other.

    --
    Best Regards / Viele Grüße
    Peter Fleischer (former MVP for Developer Technologies)
    Homepage, Tipps, Tricks

    Wednesday, November 6, 2019 8:27 AM
  • Hi,

    end the input and press Enter

       private void TextBox_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.Key == Key.Enter)
                {
                    
                }
            }

    Best Regards,

    Alex


    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.

    • Marked as answer by cally_kalpana Wednesday, November 6, 2019 8:58 AM
    Wednesday, November 6, 2019 8:28 AM
    Moderator
  • Thanks alex, I should have specified how I want to it be ..just could not think, any links to all this event handlers reference on MSDN site.
    Wednesday, November 6, 2019 8:58 AM
  • Hi,
    I change the code in my answer in previous thread. In the new demo pressing the Enter key to finish the input and to check the rule.

    --
    Best Regards / Viele Grüße
    Peter Fleischer (former MVP for Developer Technologies)
    Homepage, Tipps, Tricks

    Thursday, November 7, 2019 8:13 AM