Basic math my friend. You are on the right track with the left and top, but those numbers are going to have to change based on the button. So those settings are going to be calculated based on an equation. As for the rows, that will be dependent on the counter.
vb
Dim intLoop As Integer
' Off sets
Dim y As Integer = 15
Dim x As Integer = 0
' Loop through buttons
For intLoop = 0 To 10
' Create button and set its width
Dim newbutton As New Button
newbutton.Width = 80
newbutton.Height = 20
' If we have hit 4 buttons, adjust the y value by adding 10 onto the controls height
' Reset x back to 0
If intLoop Mod 4 = 0 Then
' This gives us a 10 pixel buffer below each row of buttons
y += newbutton.Height + 10
x = 0
End If
' Set the text and set its top and left based on its dimensions and count
newbutton.Text = "New Button"
newbutton.Top = y
' This gives us a 5 pixel right buffer between buttons
newbutton.Left = 26 + (x * (newbutton.Width + 5))
x += 1
Me.Controls.Add(newbutton)
Next
Notice that every four buttons we reset the x value back to zero and increment the y (height) based on the buttons height plus a 10 pixel buffer. For each button we also adjust its left based on the buttons width plus a 5 pixel buffer.
The result is the grid style you are looking for. Feel free to adjust the 10 and 5 or the button's height/width to get a grid that suits your needs.
Enjoy!
"At DIC we be button grid printing code ninjas... just remember that no grid can stop us!"