I'm using ListView control, with SmallIcons style in VB.NET. Icons are loaded fine, but when I start to scroll ListView down or up from scrollbar (clicking from arrows), rowheight drops to about half from normal in next 20-30 rows below/above upper/bottom row (depends from the scrolling position). After 1-2 seconds, ListView is "refreshed" and scrolling continues normally. When focus in on the ListView and I'm moving up/down with arrow keys or PageUp/PageDown, everything is normal. Any suggestions, what is happening? SmallIcons size is 16 * 16. Is it compulsory to set "Blank icon" with SmallIcon size to all rows, when adding them or what? Wasn't like that in VB6, how is it in VB.NET?

Recommended Answers

All 4 Replies

Please post your code we will happy to solve that...

Please post your code we will happy to solve that...

lstFiles.Columns.Add("Artist", Convert.ToInt32(lstFiles.Size.Width * (ColWidth_Artist / 100)), HorizontalAlignment.Left)
        lstFiles.Columns.Add("Album", Convert.ToInt32(lstFiles.Size.Width * (ColWidth_Album / 100)), HorizontalAlignment.Left)
        lstFiles.Columns.Add("Track", Convert.ToInt32(lstFiles.Size.Width * (ColWidth_Track / 100)), HorizontalAlignment.Center)
        lstFiles.Columns.Add("Song", Convert.ToInt32(lstFiles.Size.Width * (ColWidth_Song / 100)), HorizontalAlignment.Left)

        lstFiles.Columns.Add("Index", 0)
        lstFiles.Columns.Add("Longname", 0)
        lstFiles.Columns.Add("Filename", 0)

        Dim lvItems(UBound(Library)) As ListViewItem

        For FileCount = LBound(Library) To UBound(Library)

            lv = New ListViewItem
            lv.Text = SongArtist
            lv.SubItems.Add(SongAlbum)
            lv.SubItems.Add(SongTrack)
            lv.SubItems.Add(SongName)
            lv.SubItems.Add(FileCount)                          
            lv.SubItems.Add(FullFileName)       
            lv.SubItems.Add(FileName)
            lvItems(FileCount) = lv

        Next
        lstFiles.Items.AddRange(lvItems)

I'm using AddRange to add those new ListViewRows, because the row count is so huge. Otherwise it takes forever. Columns "Index", "LongName" and "FileName" are hidden, therefore the column width is set to 0. First 4 columns cover the width of ListView.
Library is "Dim Library() As ListBoxRows", that's where all the data for the ListView is. Otherwise it's just normal scrolling by mouse or by keyboard, no code written for that in ListView's Events. And then the rows get "funny looking". It does not happen, when you are scolling fast by dragging from scrollbar, just when you are clicking the top/bottom arrow??? And even then only for the first 20-30 rows, after that everything is ok.

It does not happen, when you are scolling fast by dragging from scrollbar, just when you are clicking the top/bottom arrow??? And even then only for the first 20-30 rows, after that everything is ok.

What u r trying to say???

What u r trying to say???

Well, it's all seen in the attachment picture (in my last thread), some of the ListView rows are only half of normal height when scrolling with mouse! Can't be more precise than that. That really is what happens.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.