Dim ctls() As WinForm.Control = {e.Form.Controls("Button1"),e.Form.Controls("Button2"),e.Form.Controls("Button3"),e.Form.Controls("Button4"),e.Form.Controls("Button5")}
Dim i As Integer, j As Integer
For i = 0 To ctls.length - 1
For j = i + 1 To ctls.length -1
If ctls(i).top > ctls(j).top Then
Dim temp = ctls(i)
ctls(i) = ctls(j)
ctls(j) = temp
End If
Next j
Next i
Dim c As Integer = (ctls(ctls.Length-1).top - ctls(0).top) / (ctls.length-1)
For i = 0 To ctls.length-1
ctls(i).top = ctls(0).top + i * c
Next