I want to deal with the arrangement of the buttons. for example i have 10 buttons, i want that after 5 buttons the next 5 buttons will go to the nextline. Here is the code that i have used:
For i = 1 To 10
Dim btn As New Button
btn.Width = 40
btn.Height = 30
btn.TextAlign = ContentAlignment.MiddleCenter
If i.ToString.Length = 1 Then
btn.Text = "B" & "0" & i
Else
btn.Text = "B" & i
End If
btn.Visible = True
btn.Tag = "Button" & i
Panel1.Controls.Add(btn)
If i <= 5 Then
btn.Location = New Point(10 * 1 + ((i - 1) * btn.Width), 10)
Else
btn.Location = New Point(10 * 1 + ((i - 1) * btn.Width), 10 * 1 + ((i - 1) * btn.Height))
End If
i get the wrong positioning of the buttons. kindly help me on this. i always get this kind of position. ex:
* * * * *
*
*
*
*
*
What i want is this:
* * * * *
* * * * *
additional: How can i do it with backgroundworker...?