Windows Develop Bookmark and Share   
 index > Windows Forms General > Setting combobox's dropdownstyle does not allow combobox to lose focus when tabbing out
 

Setting combobox's dropdownstyle does not allow combobox to lose focus when tabbing out

Hi all,

I am using .NET 1.1 and ran across and problem. The requirement is when the combobox is focused, it displays the drop down list. Otherwise, it's style is set to simple.

The problem is that whenever I set the dropdownstyles of the combobox, focus is immediately returned to the combobox. For example, in the lostfocus or leave event handler, I set the dropdownstyle to simple and yet, the combobox still havefocus when I try to tab out of it. Tabbing should be to the next control.

Can anyone suggest a way around this that can still meet the requirement mentioned? Or is there a patch for 1.1 that solves this? Thanks.

Felix Chung  Tuesday, May 20, 2008 8:08 PM

Hi Felix Chung,

I can reproduce this issue with your description and I have to admit that the behavior is less desirable. To feedback this issue in a formal way, could you please go to our Connect portal site and submit it?

In your feedback, you can quote the URL to this thread, so that the whole conversation can be available. Every feedback submitted will be evaluated carefully by our engineers. They will let you know their comments further through that portal. It would be great if you can also paste the link to the submitted feedback here, so that other community members can see it as well.

One possible workaround is to use the Control.BegineInvoke to avoid this issue.

Code Snippet

private void comboBox1_Leave(object sender, EventArgs e)

{

this.comboBox1.BeginInvoke(new MethodInvoker(MyMethod));

}

void MyMethod()

{

this.comboBox1.DropDownStyle = ComboBoxStyle.Simple;

}

Hope this helps.
Best regards.
Rong-Chun Zhang

Windows Forms General FAQs
Windows Forms Data Controls and Databinding FAQs

Rong-Chun Zhang  Monday, May 26, 2008 10:13 AM

Hi Felix Chung,

I can reproduce this issue with your description and I have to admit that the behavior is less desirable. To feedback this issue in a formal way, could you please go to our Connect portal site and submit it?

In your feedback, you can quote the URL to this thread, so that the whole conversation can be available. Every feedback submitted will be evaluated carefully by our engineers. They will let you know their comments further through that portal. It would be great if you can also paste the link to the submitted feedback here, so that other community members can see it as well.

One possible workaround is to use the Control.BegineInvoke to avoid this issue.

Code Snippet

private void comboBox1_Leave(object sender, EventArgs e)

{

this.comboBox1.BeginInvoke(new MethodInvoker(MyMethod));

}

void MyMethod()

{

this.comboBox1.DropDownStyle = ComboBoxStyle.Simple;

}

Hope this helps.
Best regards.
Rong-Chun Zhang

Windows Forms General FAQs
Windows Forms Data Controls and Databinding FAQs

Rong-Chun Zhang  Monday, May 26, 2008 10:13 AM
Thanks, it is at https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=346217.
Felix Chung  Tuesday, May 27, 2008 12:22 AM

You can use google to search for other answers

Custom Search

More Threads

• How to fast refresh a control to handle large amount of data?
• index errors with a wrapping listbox class
• How to make a public variable in a .exe accessible to another application that references it
• Copy TreeView items checked states from treeview to another ??
• enabling/disabling contextmenu
• How to port C to VB.NET
• Small Windows in Corner ..Like when you get an Email in Outlook 2003.
• Looking for a rich text editor sample app
• Can Crystal Report display multiple dataSets?
• Better Way to get what key is pressed