FartNocker Posted January 9, 2004 Posted January 9, 2004 Is there any way to use the context menus on an ComboBox while it is dropped down. Say I have 5 items in a drop down ComboBox. I click on the arrow, the box drops down, and right click on the third item. I have only been able to get the context menu to open on the currently select item (after the ComboBox has closed up). I use VB 2003. Checking for the SelectedIndex on the MouseDown event. I have also tried other methods and searched Googles and this form, MSDN and can't find anything on context menus and ComboBoxes. The ComboBox does have a property called "ContextMenu" which I have set to the "ContextMenu1" component that I am using. Can anyone confirm that in fact this can't be done. Mark Quote
AlexCode Posted January 9, 2004 Posted January 9, 2004 I think that with a little work you can use the technique described in the following link to grab the handle of the dropdown listbox and show the contextmenu... I think... http://www.vbaccelerator.com/home/NET/Code/Controls/ListBox_and_ComboBox/Reusing_the_Combo_Dropdown/article.asp Tell me something. Alex :D Quote Software bugs are impossible to detect by anybody except the end user.
FartNocker Posted January 10, 2004 Author Posted January 10, 2004 Thanks for the link Alex but it looks as if his code is all in c# Mark Quote
yewmeng Posted January 10, 2004 Posted January 10, 2004 try this code at combo box selected index change combobox.ContextMenu = ContextMenu1 Quote
AlexCode Posted January 12, 2004 Posted January 12, 2004 It's not hard to translate C# to VB.net... It's all quite the same. Have a look on that. If I had a little more time a would translate it for you... But I can help you translating the pieces you don't understand... I'll be here if you need me :p Alex :D Quote Software bugs are impossible to detect by anybody except the end user.
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.