Hi, i need to validate some text in a text box and restrict entering invalid characters.
So i thought to use Key_Pressed event. But this event doesn't fire when i paste some text directly in the text box. what event can be used for paste text in a text box in .NET?

Recommended Answers

All 5 Replies

But TextChaged event does. Use this one, and do restrictions inside this event.

BTW, what are the invalid characters?

I need to enter arabic date (hijridate) in arabic numbers yyyy/mm/dd format. So i need to validate this format and allow only arabic characters in trhe text box.
Thanks for the reply.

I dont know how you will validate your arabic datetime (Iam not familiar with it), so this is up to you. Iam sure you can do something.
But most impoertant thing is that you put all the code into TextChanged event of textBox control.

thanks...!!! i'll try and update..!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.