How to lessen load time for listview

kaberto

Member
Joined
Sep 22, 2007
Messages
5
Programming Experience
Beginner
Hi!

I am using VB2003 and I am going to load images into a listview, but the way Im doing it right now takes a lot of time and memory.. before I can browse through the 200+ images, the listview has to load all images first and it takes a lot of time..

How can I lessen the load time for the listview?

(for example, windows explorer puts a temp image in the place of bitmaps before loading the bitmap thumbmark..how to do it so that I can browse the listview even though it is still loading?)

thank you for your time

VB.NET:
Dim a As Integer
Dim c As DataTable = Me.DataSet11.Tables(0)
Dim f As Integer
f = c.Rows.Count
Dim d As System.Drawing.Image
Dim frontpic As String
For a = 0 To f - 1
    ProgressBar1.Value = (ProgressBar1.Value + 1)
    frontpic = filename & System.Convert.ToString(c.Rows(a)(5)) & ".jpg"
    If frontpic = filename & ".jpg" Then
        frontpic = filename & "blankthumbnail.jpg"
    End If
    d = Image.FromFile(frontpic)
    Me.ImageList1.Images.Add(d)
    Dim item As ListViewItem = ListView1.Items.Add(System.Convert.ToString(c.Rows(a)(4)))
    item.ImageIndex = a
    Me.Label7.Text = a + 1 & " record/s found"
Next
 
Last edited by a moderator:
Also use ListView.BeginUpdate/EndUpdate methods.
 
Back
Top