I have a combobox + several textbox's on a form. Apparently the default behaviour for the comboxbox is to validate the content when the tab key is pressed, then move to the next control in the tab order. I would like to mimic this behavior when the 'Enter' key is pressed. So far I've done this:
private void cmbVendorList_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
MessageBox.Show("hello");
}
I need to replace the messagebox with some code that will cause the combobox to validate, then move to a textbox. Any suggestions or input on a better way to accomplish this task?
Update: I found that placing this code: 'txtMy.focus' in place of the messagebox complished this task. However that leads to ask a more general question: The focus event does not appear in the properties window of the C# environment that I'm using. I found this to be true of several properties/events I've tried to use in the past. Is it because I'm using C# 2008 Express Edition?
Loading

Sam HobbsRank #108 · 20.5K reputationPosted Sep 7, 2010, 11:07 AM EDT
Ron44 reputationPosted Sep 7, 2010, 12:24 PM EDT
Please forgive me if this seems like a dump question, as I'm new to C#.
Sam HobbsRank #108 · 20.5K reputationPosted Sep 7, 2010, 1:50 PM EDT
Vlado Raskovic8 reputationPosted Feb 20, 2012, 10:19 AM EST