tags:

views:

43

answers:

2
    Dim count As Integer
    For count = 1 To 10 Step 1
        Dim But+count As New Button
        myButton+count.Width = 100*count
        myButton+count.Height = 20*count
        myButton+count.Top = 50 *count
        myButton+count.Left = 50*count
        Me.Controls.Add(myButton+count)
    Next

Dim But+count As New Button => How to make it work

+4  A: 

How about making an array and instantiating the item at the 'ith' position each iteration of the loop. It wouldn't be a1, a2, a3,...; but it would be a[1], a[2], a[3],....

Dave McClelland
Thank, i will do this
Snoob
+2  A: 
Dim buttons(9) As Button
For count As Integer = 0 To 9
        Dim button As New Button
        button.Width = 100*count
        button.Height = 20*count
        button.Top = 50 *count
        button.Left = 50*count
        Me.Controls.Add(button)
        buttons(count) = button
Next
Victor Marzo