473,383 Members | 1,877 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,383 software developers and data experts.

Listview: How to know which column has been selected

Hi,

I can detect which ListviewItem has been selected like the code below, but I
can't detect which subItem has been selected. Any help will be great
appreciated.

Private Sub ListView1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseUp
dim lvItem As ListViewItem
lvItem = Me.ListViewMethod.GetItemAt(e.X, e.Y)

End sub

Peter
Nov 21 '05 #1
4 1413
Use:
ListView1.SelectedItems(0)

[]s
Cesar

"Peter" <zl*****@sina.com> escreveu na mensagem
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hi,

I can detect which ListviewItem has been selected like the code below, but I
can't detect which subItem has been selected. Any help will be great
appreciated.

Private Sub ListView1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseUp
dim lvItem As ListViewItem
lvItem = Me.ListViewMethod.GetItemAt(e.X, e.Y)

End sub

Peter

Nov 21 '05 #2

"Ronchese" <ro******@smlinfo.com.br>
Wrote:eA**************@TK2MSFTNGP09.phx.gbl...
Use:
ListView1.SelectedItems(0)


Ronchese,
The listview may have several subitems, I mean I want to detect which
subitem is in the place where mouse is at. So I'm not sure I can use
SelectedItems(0), SelectedItems(1) or SelectedItems(2).

Thank you

Peter

Nov 21 '05 #3
Send the LVM_GETSUBITEMRECT message to the ListView control. You might have
to use P/Interop

-Atul, Sky Software http://www.ssware.com
Shell MegaPack ActiveX & .Net
Drop In Windows Explorer like Shell Browsing GUI controls for your app.

"Peter" <zl*****@sina.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hi,

I can detect which ListviewItem has been selected like the code below, but
I
can't detect which subItem has been selected. Any help will be great
appreciated.

Private Sub ListView1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseUp
dim lvItem As ListViewItem
lvItem = Me.ListViewMethod.GetItemAt(e.X, e.Y)

End sub

Peter

Nov 21 '05 #4
Thank you, Atul. I will try.

Peter

"Atul" <atulatsswaredotcom> wrote:uH*************@TK2MSFTNGP12.phx.gbl...
Send the LVM_GETSUBITEMRECT message to the ListView control. You might have to use P/Interop

Nov 21 '05 #5

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

Similar topics

0
by: Mike Barrett | last post by:
I have a strange one here and I believe it is a bug. I googled it and saw others having a similar issue and nobody seems to have a fix. I will take another shot. I get this ERROR MESSAGE... ...
9
by: Devron Blatchford | last post by:
Hi there, Just wondering if I change the back and fore colour of a listview item when the mouse hovers over it? I want to overide the default windows colour. Can someone please tell me how to...
4
by: Hunter Kirk | last post by:
I'm having a rather tedious problem with the listview control in visual basic.net I am trying to achive two simple procedures, I thought :) 1. I have only one column populated but still there...
0
by: Mike Barrett | last post by:
I have a strange one here and I believe it is a bug. I googled it and saw others having a similar issue and nobody seems to have a fix. I will take another shot. I get this ERROR MESSAGE... ...
5
by: billuy | last post by:
Is there a way to sort by a specified column in a listview? I'd like my users to be able to click on the column heading and have the listview sort by that column. Thanks, Billyb
21
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each...
12
by: Dennis | last post by:
I have a form which has a ListView control named ListView1 added at design time. When I add items using the following code, they don't appear in the list view. However, if I create a ListView...
5
by: John Devlon | last post by:
Hi, Does anyone know how to get a value of a second column of a selected item in Listview. I've create a listview and added this code Listview.Items.Clear() Listview.Columns.Clear()...
1
by: =?Utf-8?B?TWFyayBDb2xsYXJk?= | last post by:
Hello I've added a listview to my WinForms C# 2.0 application. The listview is displayed in Details view and has the FullRowSelect property set to true. I'm using the listview control like a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.