×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

very slow to create at run time listview

very slow to create at run time listview

very slow to create at run time listview

(OP)

CODE

Private Sub CREA_LVORARI()

    Dim DA As Date, A As Date
    Dim D As Date

    DA = "07:00"
    A = "21:30"

    With Me.LVORARI

        LockWindowUpdate Me.hwnd

        .ColumnHeaders.Clear
        .ColumnHeaders.Add , , "TAVOLO", 2000
        .ColumnHeaders.Add , , "DATA", 1000, lvwColumnCenter

        For D = DA To A + 0.000001 Step TimeSerial(0, 30, 0)
            .ColumnHeaders.Add , , Format$(D, "HH:MM"), 600, lvwColumnCenter
        Next D

        For K = 0 To UBound(STRDBROWS_TAVOLI, 2)
            TAVOLO = STRDBROWS_TAVOLI(2, K) & "-" & "TAVOLO-POSTI: " & STRDBROWS_TAVOLI(1, K)
            Set ITMX = .ListItems.Add(, , TAVOLO)
        Next K

        LockWindowUpdate 0&

    End With

End Sub 

i call:

Private Sub Form_Initialize()
call CREA_LVORARI
End Sub

note:
STRDBROWS_TAVOLI is an array variant from getrow of recorset
Me.LVORARI is the listview
the array have only 23 element!

RE: very slow to create at run time listview

How big is the array - and how are you determining that it is "very slow"?

RE: very slow to create at run time listview

(OP)
the array have only 23 element!

20 SECS approx

RE: very slow to create at run time listview

Ok, then there is something else going on in your code. If we just use the code you present here (and with an artificial STRDBROWS_TAVOLI array) then the LV populates pretty much instantaneously. Have you, for example, got any events for the ListView?

RE: very slow to create at run time listview

(OP)
wath type of event, for example?

RE: very slow to create at run time listview

Er ... it's your code, you should be able to see if you have any events defined. I'm not going to randomly guess.

And let's also be clear - I am speculating; a control event might be the cause of the slowdown. But there may be other causes. Without seeing your code there's no way right now to determine what is actually causing the slowdown. It might, for example, be linked to the Sorted property (although I doubt it). Or anything, We can't know from the code you have posted here so far.

RE: very slow to create at run time listview

>BeginUpdate and EndUpdate

That's for the .Net listview control. This forum is for classic VB (VB5/6), and its somewhat less functional listview control

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close