grip003 Posted November 1, 2004 Posted November 1, 2004 I am having a very strange problem with the current application I am writing. I am using mdi for all forms, with a single parent form. I open form 1 first, which contains a textbox with a keypress event that picks up when the enter key is pressed. It works fine, until I open form 2 and then set my focus back to form 1. It's like the keypress event no longer fires in form 1. However, if I close form 2 and go back to form 1, the keypress event works again. To clarify: 1) Open form 1 -> keypress works 2) Open form 2 3) Go back to form 1 -> keypress doesn't work 4) Go to form 2 and close it 5) Go back to form 1 -> keypress works I'm really stumped on this one. If anyone has any ideas or has seen this and found a way around it, please let me know. Oh, just in case this is a question, neither form has the keypreview set to true. Thanks. Quote
Administrators PlausiblyDamp Posted November 1, 2004 Administrators Posted November 1, 2004 Any chance you could post the relevant code (or attach the source - no binaries please). Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
grip003 Posted November 1, 2004 Author Posted November 1, 2004 Thanks for the quick response... I tried to re-write a small app with the appropriate problem in it, however I can't get this one to fail like my real application. But, the problem seems to be very difficult to pin down. I closed .net and then re-opened it. Then I tried what I stated above and the keypress event only fired when the second form was up, not when it was closed! This is really strange, and I would love to post my code, but I don't even know where to begin. My application is well over 10,000 lines now, and it connects to a mySql database, so I can't post my entire code. I think it will just take a while to iron out. Maybe the actual executable would run ok...I'll give that a try next. Quote
Wile Posted November 1, 2004 Posted November 1, 2004 Do you do any 'focus the other form' from code in your application? It could be that something is going wrong with that. I wouldnt trust fullly on the 'just try the exe' solution, that usually means the next time the problem pops up, it is at an extremely pisssed of end-user ;). Quote Nothing is as illusive as 'the last bug'.
grip003 Posted November 2, 2004 Author Posted November 2, 2004 I don't do any funky focus stuff on either of the forms in question. The same problems cropped up on the executable, so it wasn't some kind of debugging glitch. I'm putting this one on the back burner for now. I may be converting my application to sdi and get rid of the problem entirely. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.