By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

ListView Right Click Event

P: n/a
I have a list view with couple of items in it.
When I left click on an item, a form opens displaying that item's
properties. So that works fine.

However, accidentally I found out that when I right click on my list view
item, the click event gets generated twice and causes my application to
crash because sender.parent is nothing.

How can I restrict my list view to react only on left click or behave the
same way even when right clicked. Either one will be fine for me.

Regards, Dino
--
-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com

Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dino, if you want to cancel the right click of the mouse (in the mouse down
event) check if e.Button = MouseButtons.Right and just ignore it. This
would necessitate changing where your code fired from (MouseDown vs. Click)
..

On the other hand.... If sender is Nothing Then Exit Sub

"Dino M. Buljubasic" <dino.buljubasic([no spam])@rivusglobal.com> wrote in
message news:XH_Mb.13983$Eq.10770@clgrps12...
I have a list view with couple of items in it.
When I left click on an item, a form opens displaying that item's
properties. So that works fine.

However, accidentally I found out that when I right click on my list view
item, the click event gets generated twice and causes my application to
crash because sender.parent is nothing.

How can I restrict my list view to react only on left click or behave the
same way even when right clicked. Either one will be fine for me.

Regards, Dino
--
-------------------------------------------------------------------------
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com

Nov 20 '05 #2

P: n/a
* "William Ryan" <do********@nospam.comcast.net> scripsit:
Dino, if you want to cancel the right click of the mouse (in the mouse down
event) check if e.Button = MouseButtons.Right and just ignore it. This
would necessitate changing where your code fired from (MouseDown vs. Click)


Typically, 'MouseUp' is used in this case instead of 'MouseDown'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.