473,652 Members | 3,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Right click event on ComboBox

Hi,

I want to create menu , when my user right click from combo box's list item.
I use Contextmenu property of combobox and assign menu for it, but it only
effected when combobox's list item not active. When my user on any
combobox's item and he right click the mouse , menu doesn't appear.

How to create menu.

Thanks in advance.

Hardik Shah.

Dec 20 '05 #1
2 4847
Hi,

this code works for my listBox:
(myFormMenuItem Delete and myFormMenuItemE dit must be defined as context menu
items)

' Only act on the right-button-click event to display the context menu

If e.Button = Windows.Forms.M ouseButtons.Rig ht Then

Try

Dim myListViewItem As ListViewItem = myFormListView. GetItemAt(e.X, e.Y)

' Only if the user clicked on a valid ListViewItem

If Not myListViewItem Is Nothing Then

myFormMenuItemD elete.Enabled = True

myFormMenuItemE dit.Enabled = True

myIndex= myListViewItem. Index()

Else

' The user did not richt-click on one of the ListView items

myFormMenuItemD elete.Enabled = False

myFormMenuItemE dit.Enabled = False

End If

Catch ex As Exception

myFormMenuItemD elete.Enabled = False

myFormMenuItemE dit.Enabled = False

MsgBox(ex.ToStr ing)

End Try

End If

Hope this helps,

Josef

"Hardik Shah" <ha********@hot mail.com> schrieb im Newsbeitrag
news:u4******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

I want to create menu , when my user right click from combo box's list
item.
I use Contextmenu property of combobox and assign menu for it, but it only
effected when combobox's list item not active. When my user on any
combobox's item and he right click the mouse , menu doesn't appear.

How to create menu.

Thanks in advance.

Hardik Shah.

Dec 20 '05 #2
Hi,
First of all thanks for your reply.

Can you tell me how can I use your code (with which event).

Hardik Shah

"Josef Brunner" <jo**@newsgroup s.nospam> wrote in message
news:u6******** *****@TK2MSFTNG P11.phx.gbl...
Hi,

this code works for my listBox:
(myFormMenuItem Delete and myFormMenuItemE dit must be defined as context menu items)

' Only act on the right-button-click event to display the context menu

If e.Button = Windows.Forms.M ouseButtons.Rig ht Then

Try

Dim myListViewItem As ListViewItem = myFormListView. GetItemAt(e.X, e.Y)

' Only if the user clicked on a valid ListViewItem

If Not myListViewItem Is Nothing Then

myFormMenuItemD elete.Enabled = True

myFormMenuItemE dit.Enabled = True

myIndex= myListViewItem. Index()

Else

' The user did not richt-click on one of the ListView items

myFormMenuItemD elete.Enabled = False

myFormMenuItemE dit.Enabled = False

End If

Catch ex As Exception

myFormMenuItemD elete.Enabled = False

myFormMenuItemE dit.Enabled = False

MsgBox(ex.ToStr ing)

End Try

End If

Hope this helps,

Josef

"Hardik Shah" <ha********@hot mail.com> schrieb im Newsbeitrag
news:u4******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

I want to create menu , when my user right click from combo box's list
item.
I use Contextmenu property of combobox and assign menu for it, but it only effected when combobox's list item not active. When my user on any
combobox's item and he right click the mouse , menu doesn't appear.

How to create menu.

Thanks in advance.

Hardik Shah.


Dec 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2018
by: George Hester | last post by:
In a page I have when the user left-clicks the page a Input box for a form gets the focus. But if the user right-clicks the page the Input box is not getting the focus. I'd like the Input box to get the focus no matter where on the page the user clicks be it right-click or left-click. Right now there is no context menu when the user right-clicks. Do you think that's the problem? Any ideas how to get this right-click left-click Input box...
7
1800
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to know if I am using the right object to reach my goal. And I don't want to spend hours to find out, would you tell me if I'm going in the wrong path? Private dbConnector As New OleDbConnection
2
2690
by: Uninvisible | last post by:
I have put together a db for a law firm to keep track of counterfeit activities. There are four parent tables: tblContact tblTransaction tblAction tblFile I have created a form, frmNewMatter, for adding new records to the db. The form is based on tblFile and has a subform based on tblContact,
3
4378
by: Wajih-ur-Rehman | last post by:
I am developing a C# app. I want to do something when someone double clicks on a combo box. But this event never fires. Any suggestions? Thanx!
4
3854
by: perspolis | last post by:
hi I manage a double click event in a combo box.. but this event doesn't fire ???? I don't know why??
11
2572
by: Terry Olsen | last post by:
How can I catch a right-click on a DropDownMenuItem?
0
1416
by: Hardik Shah | last post by:
Hi, I want to create menu , when my user right click from combo box's list item. I use Contextmenu property of combobox and assign menu for it, but it only effected when combobox's list item not active. When my user on any combobox's item and he right click the mouse , menu doesn't appear. How to create menu. Thanks in advance.
1
1149
by: fiaolle | last post by:
Hi I have a DataGrid with comboboxes and I'm woundering what runs when a user clicks in the DataGrid or ComboBox. When I choose something in the combobox with the KeyUp event nothing happens, but when I click and choose an item in my combobox a new row appear in the DataGrid and that is what I want to happen when I choose an item by pressing keys. Is there someway I can get the same thing to happen whether I click or press keys. Please...
2
3125
by: dneupane | last post by:
Hi all How can I get combobox autocomplete working with button click event, my application cannot use keyboard, so I have soft keypad. Any help would be greatly appreciated. Regards Niju
0
8367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8703
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.