index is not longer to used in vb.net
use array
dim tb() as textbox
u can copy and paste it
Dim textboxGrid(8, 8) As TextBox
Private Sub makeGrid()
Dim txtBox As TextBox
Dim xPos, yPos As Integer
yPos = 45
For row As Integer = 0 To 8
xPos = 20
For column As Integer = 0 To 8
txtBox = New TextBox
txtBox.Parent = Me
txtBox.Location = New Point(xPos, yPos)
txtBox.BorderStyle = BorderStyle.FixedSingle
txtBox.Multiline = True
txtBox.Size = New Size(50, 50)
txtBox.Text = "0"
txtBox.TextAlign = HorizontalAlignment.Center
textboxGrid(row, column) = txtBox
Me.Controls.Add(txtBox)
xPos += 50
Next
yPos += 50
Next
End Sub
the u will have to do "for each" and "typeof"
regards
David S. Zuza wrote:
Hey,
I am new to .NET and I would like to index a button control on my form
just like I used to be able to in VB6. In VB6 all I had to do was create one
control and new to something like
cmdButton()
and then I could copy it in the design window and refer to anyone of the
buttons by refencing its index like
cmdButton(43).Backcolor = vbRed
how could I accomplish the same thing in .NET
I was considering creating each button at runtime but it would be better if
I could design and place each button considering that there is over 80
different buttons and their placement is crucial.
thanks for the help in advance