I'd like to know what line your code is crashing at, but here's my guess:

A ListViewItem is a reference type. When you add item to TestArray(i), you are only adding a reference to the item. When you call .Items.Clear(), you destroy the object that both the ListView and TestArray referenced, so now TestArray is an array of 41 (stupid VB array syntax means your array has 0 through 40 = 41 elements) references to Nothing.

This problem could be solved by changing the last line of the For loop in the Load handler to:
TestArray(i) = item.Clone()

Although for lots of ListViewItems this could get expensive. The way I handle situations like this is to create a class that has a member for each item, and a method that returns a ListViewItem properly initialized. This way, you keep an array of these objects, and you don't have to worry about cloning.

The problem with your code is Populate() function is running multiple times as it's called on lvwLibrary2_SizeChanged event. So i've added a boolean variable ivlLodingList to check whether populate() function is running if not it will get called.

Public Class SystemTray
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

For i = 0 To VitemCount - 1
Try
.Items.Add(TestArray(scrollV.Value + i))
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next
PreviousVItemCount = VitemCount
End If
End With
End Sub

Public Sub Scroll()
With lvwLibrary2
If Me.lvwLibrary2.Items.Count > 0 Then
If scrollV.Value < OldValue Then
.Items(.Items.Count - 1).Remove()
.Items.Insert(0, TestArray(scrollV.Value).Clone)
ElseIf scrollV.Value > OldValue Then
.Items(0).Remove()
.Items.Add(TestArray(scrollV.Value).Clone)
End If
OldValue = scrollV.Value
End If
End With
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ivlLodingList = True 'initialize a variable to true so that populate() will not get reloaded on loop
Populate() 'this works fine, only crashes when it resizes
ivlLodingList = False
End Sub

Private Sub lvwLibrary2_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvwLibrary2.SizeChanged
If FormLoaded And ivlLodingList = False Then 'Check whether Populate() is running
ivlLodingList = True 'initialize a variable to true so that populate() will not get reloaded on loop
Populate()
ivlLodingList = False
End If
End Sub

When you want to add all items in the array to the ListView, you would simply do

For Each item as DataItem in TestArray
lvwLibrary2.Items.Add(item.ToListViewItem)
Next

This seems roundabout, but it accomplishes a few things. First, it stores your data in a format that is both easy for you to work with and easy to convert to the display format you want. Second, since DataItem is separate from the ListViewItem, you can do whatever you want with the ListViewItem without having to worry about whether you are changing the array.

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.

Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message. In the To field, type your recipient's fax number @efaxsend.com.
You can even send a secure international fax — just include t…

Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…