473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ListView Right Click Event

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
2 6765
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
* "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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Richard | last post by:
Hi. I use a ListView to display data in tabular form. Each ListView row corresponds to a data record. The ListView Item of the record is the record key or code. Each SubItem in that row...
2
by: VR | last post by:
I have a form with a list view control, a button control and a main menu with menuDelete item. Any time I am handling a button click event or menuDelete click event I call DeleteItem() function...
1
by: andrewcw | last post by:
The clcik event on the ListView control seems to trigger off the item level ( the first column ). I would like to be able to trap the click event on a particular subitem ( a specific column's row...
2
by: Michael C | last post by:
Hi all, When I try to use the GetItemAt (e.X, e.Y) method in a ListView MouseDown() event, it only works some of the time. If I right-click on an open area of the ListView, I get null back as...
13
by: Maheshkumar.R | last post by:
hi groups, I have placed an listview control, i want to iterate thru the control and find the clicked event items. listView2.Items.Add(fname.ToString(), i); how i can perform the iteration...
4
by: Pucca | last post by:
How can I tell a mouse right clicks over a listview item that's in a container panel. I only want to display a popup menu if the user right click the mouse over an item on the Listview. I don't...
6
by: Brandon McCombs | last post by:
Hello, I have a form that contains a listview on the left side and a column of buttons on the right side. Only some of the buttons do I want enabled all the time. The other buttons should be...
0
by: da3vilgenius | last post by:
I have a listview and I'd like to be able to do some stuff on a right click event of the column header but the columnclick event only handles left clicks. I looked around on the net and found that...
12
by: Tom Bean | last post by:
I am trying to display a ContextMenuStrip when a user right-clicks on an item in a ListView and have encountered a something that seems strange to me. When the ListView is initially populated,...
2
by: Tom P. | last post by:
I am writting a extended ListView control and I'd like to stop the default behavior when a user right-clciks on a non-label area and then drags causing a "marching ants" selection box to appear....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...

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.