If what you are after is "press a dynamically created button and access the related dynamically created Textboxes in the event handler" then it's pretty simple: just use the Tag property:
Private Sub AddControls()
...
Dim panellAdd As New Panel()
For i As Integer = 1 To 9
Dim tb1 As New TextBox()
Dim tb2 As New TextBox()
Dim b As New Button()
b.Tag = tb1
tb1.Tag = tb2
b.Click += New EventHandler(AddressOf b_Click)
...
panellAdd.Controls.Add(tb1)
panellAdd.Controls.Add(tb2)
panellAdd.Controls.Add(b)
Next
...
End Sub
Private Sub b_Click(sender As Object, e As EventArgs)
Dim b As Button = TryCast(sender, Button)
If b IsNot Nothing Then
Dim tb1 As TextBox = TryCast(b.Tag, TextBox)
Dim tb2 As TextBox = TryCast(tb1.Tag, TextBox)
...
End If
End Sub
"Error 'Public Event Click(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
b.Click += New EventHandler(AddressOf b_Click)
im getting an error"
Sorry - I wrote it in C# and used an automatic translator - and forgot to check that bit :doh:
Replace the line with:
AddHandler b.Click, AddressOf b_Click