Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Toggling ListView Checkbox visibility problem

Status
Not open for further replies.

NeilFrank

Programmer
Mar 12, 2000
167
CA
I am unable to use the simple commands

LVFoo.Checkboxes = True and
LVFoo.Checkboxes = False

to show/hide Checkboxes on a ListView (.View = lvwReport, 3 columns) when there are enough items so that it has a vertical scroll bar.

These instructions lead to a corrupted display: there is incomplete display of all ListView items and blank phantom lines show up at the start and end.

A kludgey fix is:

Public Sub ChangeCheckboxesOnLVFoo(blnChecked As Boolean)
Dim intLine As Integer
With LVFoo
.Checkboxes = blnChecked
For intLine = 1 To .ListItems.Count
.ListItems(intLine).Checked = blnChecked
.ListItems(intLine).Checked = Not (blnChecked)
Next intLine
.ListItems(.ListItems.Count).EnsureVisible
.ListItems(1).EnsureVisible
End With

End Sub

Is there a better way?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top