Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My form closes automatically on enter key press 1

Status
Not open for further replies.

BlueGhost79

Programmer
Feb 6, 2008
11
US
I have a form that when it loads everything is fine.

When ever I press the enter key they FormClose function is called. I am not calling Close() anywhere. I know it has something to do with the focus becuase if I click on a button then press enter everything is ok, but if I dont click on anything or click on a listview and then press enter the form closes. It does not even call the onkey down event of the listview control that currently has focus, just goes straight to the form close().

any ideas?
 
Do you have a close button on the form? If so, is it possible that the button is the default button that is called when you press enter?


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
No, I dont have a close button. Another strange thing is that I have 2 buttons with no code behind them and when I click them the form closes as well. Even when I press enter in an edit box that has focus the form closes.
 
Got it.
I had to delete those buttons for some reason and create 2 new ones.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top