By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,996 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,996 IT Pros & Developers. It's quick & easy.

TextBox, TAB and OnLeave event

P: 31
I have an annoying issue with a simple textbox control. I'm trying to catch the TAB key with KeyUp (nothing else works), but for some reason as soon as I hit it (before KeyUp!), OnLeave fires and messes things up. Why? What's causing it? In that particular place, no events are fired before so nothing can cause focus change!

M.
Jun 26 '07 #1
Share this Question
Share on Google+
3 Replies


kenobewan
Expert 2.5K+
P: 4,871
Sounds like another event is firing?
Jun 26 '07 #2

P: 31
Sounds like another event is firing?
yes it does, but not by my code:) my guess is that textbox's native event handles the TAB key before i try to handle it on KeyUp, which would cause this thing to happen. but how to override this behaviour?
Jun 26 '07 #3

P: 31
yes it does, but not by my code:) my guess is that textbox's native event handles the TAB key before i try to handle it on KeyUp, which would cause this thing to happen. but how to override this behaviour?
Anyway, it seems that i've found some kind of solution: overriding IsInputKey in inherited control. I simply state:

public override bool IsInputKey(Keys keyData)
{
if(keyData==Keys.Tab)
return true;
else
return base.IsInputKey(keyData);
}

and it works. for now, that is. anyone care to elaborate?

Mecena
Jun 26 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.