Home | Index | Dotnet4all Snippets | Submit resources
About | Mail us 





Listview and label display (Saturday, August 28, 2004)



Found the following interesting discussion in the Newsgroups:

listview and label display
by:Anonymous

Hello,
I have a listview that displays a list of choices.
When the mouse moves over each item, I would like text (the name of the item that is being hovered over) to show up in a seperate label or textbox.
How do I set this?
Thanks,
Amber


 Reply:
by:Simon Jefferies

 Hello,

Create a MouseMove event on the listview in question,

Inside this event place the following code:


Dim SelectedItem As ListViewItem _
= lvwFiles.GetItemAt(e.X, e.Y)
If Not SelectedItem Is Nothing Then
MyLabel.Text = SelectedItem.Text
End If


This snippet of code will retrieve the list view item at the position of the mouse and if a valid item was found set a label's text to the text of the item. Change MyLabel to the name of your label etc.

Hope this helps
Cheers
Simon

--
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:simonj@headfirst.co.uk
-


 Reply:
by:Anonymous

 Thank You!!
It worked great!




Posted by Xander Zelders



0 Comments:

Post a Comment

<< Home

 
Previous Posts
    - Listbox problem
    - Passing a DLL vs. Reinstantiating it
    - NetworkStream .Write() method not completing
    - VB Calling a C or C++ Function?
    - Getting Information From the Browser...
    - How to use VB.NET to access the "IE history folder...
    - How to print a .rtf File (containing text & graphi...
    - Is there an HTML web form component?
    - Get filenames
    - Simple Datagrid question



Disclaimer & Terms of Use | DotNet4All.Com concept & © 2004 - 2007 by Zelders² - Holland