Link to home
Start Free TrialLog in
Avatar of riceman0
riceman0

asked on

Updating a listbox


Hey, I am adding buttons to select all or clear all in a listbox.  So far I have:

    Private Sub ButtonSelectAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectAll.Click

        For n As Integer = 0 To Me.ListBoxMonitors.Items.Count - 1
            Me.ListBoxMonitors.SetSelected(n, True)
        Next

    End Sub

This is fine except (a) there are many items, so it looks slow/ugly, and (b) it changes the scroll position.  Anybody have code that doesn't screw up the scroll position, and is there a function that allows me to suspsnd redrawing of the listbox until I've done everything I need to do?

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial