dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Jan 4, 2002

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Select a Whole Row in Any ListView


Only in VB6 do the common controls OCX files provide an option to select a full line in a listview. In earlier versions, you can select a ListItem only by clicking on the left-most column. This code allows the user to click anywhere on the line to select and highlight the ListItem:
 
Private Sub ListView1_MouseDown(Button As _
Integer, Shift As Integer, x As Single, y _
As Single)
Dim itm As ListItem
Dim i As Long
With ListView1
Set .DropHighlight = _
.HitTest(Screen.TwipsPerPixelX * 2, y)
Set itm = .HitTest(Screen. _
TwipsPerPixelX * 2, y)
Set .SelectedItem = itm
' Use the following if you have code
' to execute on a user click.
For i = 1 To .ListItems.Count Step 1
If .ListItems(i).Selected Then
Call ListView1_ItemClick _
(.ListItems(i))
Exit For
End If
Next i
End With
End Sub
Alex Whyte
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date