I just thought I would share this. It's not my code but it helped me do what I wanted. I have a Listview that can have an unknown number of rows at any time and I wanted to make sure the rows were visible (user doesn't have to resize the form to see items). I got a kick out of the code and maybe someone else will too.
Code:
Private Sub SetWindowSize()
If Me.WindowState <> FormWindowState.Minimized Then
If LstItems.Items.Count = 0 Then Exit Sub
Dim last = LstItems.Items(LstItems.Items.Count - 1)
Me.ClientSize = New Size(Me.ClientSize.Width, LstItems.Top + last.Bounds.Bottom + 60)
End If
End Sub