Closing a dropdown box on a toolstrip item
-
Hello, Sometimes coding in C#, you can't see the forest for the trees. I'm sure the answer is ridiculously simple, but it has me baffled. On a windows form, the user clicks a toolstrip item which opend a dropdown list. The user clicks a selection, dropdown list disappears, and the selected item displays towards the top. To get rid of that displayed item, you have to click anywhere else on the form. All I'm trying to do is when the user clicks their selection, close (wrong word?)down the display for that toolstrip item. (Act as if I clicked on a different portion of the form.) Thanks in advance.
-
Hello, Sometimes coding in C#, you can't see the forest for the trees. I'm sure the answer is ridiculously simple, but it has me baffled. On a windows form, the user clicks a toolstrip item which opend a dropdown list. The user clicks a selection, dropdown list disappears, and the selected item displays towards the top. To get rid of that displayed item, you have to click anywhere else on the form. All I'm trying to do is when the user clicks their selection, close (wrong word?)down the display for that toolstrip item. (Act as if I clicked on a different portion of the form.) Thanks in advance.
You could try selecting another control by doing
theControl.Select()
. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
You could try selecting another control by doing
theControl.Select()
. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
Thanks Ravi, but I get the same results. Researching the problem, it's comforting to know that I am not the only one experiencing this problem. Other users experiencing the same problem seem to report "it doesn't work" to other offered solutions. I found an old post with an answer by a Microsoft employee stating, "It's by design." Well even so . . . Kevin
-
You could try selecting another control by doing
theControl.Select()
. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
Ravi, My apologies. I'm unfamiliar with this messsage board and I hit a "down arrow" icon thinking it would scroll down to the next message. Turns out it gave you a thumbs down for your answer, which was definitely not my intention. - Kevin
-
Ravi, My apologies. I'm unfamiliar with this messsage board and I hit a "down arrow" icon thinking it would scroll down to the next message. Turns out it gave you a thumbs down for your answer, which was definitely not my intention. - Kevin
No worries. :-D /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Hello, Sometimes coding in C#, you can't see the forest for the trees. I'm sure the answer is ridiculously simple, but it has me baffled. On a windows form, the user clicks a toolstrip item which opend a dropdown list. The user clicks a selection, dropdown list disappears, and the selected item displays towards the top. To get rid of that displayed item, you have to click anywhere else on the form. All I'm trying to do is when the user clicks their selection, close (wrong word?)down the display for that toolstrip item. (Act as if I clicked on a different portion of the form.) Thanks in advance.
If I understood your question correctly, you have a ToolStripComboBox as an item of a ToolStripDropDownButton and want to close dropdown when an item of combobox is selected; so you can do this:
private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
((ToolStripItem)sender).PerformClick();
}