Re: ListView events
- From: elena <elena@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 7 Sep 2007 12:14:03 -0700
Thank you, it helps
"Peter Foot [MVP]" wrote:
You don't need to loop through the collection to find the selected items -.
use the SelectedIndices property. e.g.
If ListView1.SelectedIndices.Length > 0 Then
MessageBox.Show(ListView1.SelectedIndices(0).ToString)
End If
An item may be selected but not currently have the focus (indeed the focus
may be on another control).
Peter
--
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility
"elena" <elena@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E76CBA58-38C7-49C5-9D3F-D071BBBECC65@xxxxxxxxxxxxxxxx
Hi, Peter
the following code doesn't work:
Private Sub ListView1_ItemActivate(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ListView1.ItemActivate
MsgBox(ListView1.FocusedItem.Text)
End Sub
This one display message:
Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim item As ListViewItem
For Each item In ListView1.Items
If item.Selected = True Then
ClickIndex = item.Index
MsgBox(ClickIndex.ToString)
Exit For
End If
Next
End Sub
Please, advice
Thank you
"elena" wrote:
Hi, All
I have ListView1 populated with one column (.NET 2003 version 1.1, SP3)
I need to populate second ListView2 with a few columns when user selects
row
from ListView1.
I tried to extract the value of the selected row in
ListView_SelectedIndexChanged() event and ListView_ItemActivate(), but
seems
it doesn't work.
What event fires when row selected in the ListView? Or how can i activate
event?
Please, advice
Thank you
- References:
- Re: ListView events
- From: Peter Foot [MVP]
- Re: ListView events
- Prev by Date: Re: How do I get a Handle to a Windows Associated Menu
- Next by Date: Re: Doesn't make sense at all.......send/recv in socket...
- Previous by thread: Re: ListView events
- Index(es):
Relevant Pages
|