C# / Filter input of a textbox and display notification balloon
Posted
by
asmo
on Stack Overflow
See other posts from Stack Overflow
or by asmo
Published on 2011-02-22T23:12:15Z
Indexed on
2011/02/22
23:24 UTC
Read the original article
Hit count: 293
I'm wondering how to filter the input of a .NET textbox.
I already know that I could listen for the KeyDown event and intercept the key, but that won't filter pasted strings by a right-click menu or a CTRL+V.
I also don't wan't to completely disable the possibility of pasting of characters in the textbox. The paste action should be cancelled whenever it contains one or more invalid characters.
Finally, I'd like to display a notification balloon whenever invalid characters are either entered or pasted.
µTorrent already has this exact behavior:
How can I achieve this functionality in C# ?
© Stack Overflow or respective owner