here try something like this:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim item As New ListViewItem '("Harry Potter and the Philosopher's Stone", "J K Rowling")
item.Text = "Harry Potter and the Philosopher's Stone"
item.SubItems.Add("J K Rowling")
ListView1.Items.Add(item)
item = New ListViewItem
item.Text = "Harry Potter and the Chamber of Secrets"
item.SubItems.Add("J K Rowling")
ListView1.Items.Add(item)
item = New ListViewItem
item.Text = "Harry Potter and the Prisoner of Azkaban "
item.SubItems.Add("J K Rowling")
ListView1.Items.Add(item)
item = New ListViewItem
item.Text = "Harry Potter and the Goblet of Fire"
item.SubItems.Add("J K Rowling")
ListView1.Items.Add(item)
item = New ListViewItem
item.Text = "Harry Potter and the Order of the Phoenix"
item.SubItems.Add("J K Rowling")
ListView1.Items.Add(item)
item = New ListViewItem
item.Text = "Harry Potter and the Half-Blood Prince"
item.SubItems.Add("J K Rowling")
ListView1.Items.Add(item)
item = New ListViewItem
item.Text = "Harry Potter and the Deathly Hallows"
item.SubItems.Add("J K Rowling")
ListView1.Items.Add(item)
''
item = New ListViewItem
item.Text = "Capital"
item.SubItems.Add("Karl Marx")
ListView1.Items.Add(item)
item = New ListViewItem
item.Text = "Value, Price and Profit"
item.SubItems.Add("Karl Marx")
ListView1.Items.Add(item)
item = New ListViewItem
item.Text = "HManifesto of Communist Party"
item.SubItems.Add("Karl Marx")
ListView1.Items.Add(item)
'Now lets say i want to group by the Author.. i am only showing 2 authors but there can be hundreds in your application.
'Here is the automatic function which group the authors automatically
Dim flag As Boolean = True
For Each l As ListViewItem In ListView1.Items
Dim strmyGroupname As String = l.SubItems(1).Text
For Each lvg As ListViewGroup In ListView1.Groups
If lvg.Name = strmyGroupname …