anche se non è proprio carino al momento li faccio caricare nella page_load in questo modo dato che il labirinto è fisso 5x5:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For Each tbx As Control In Me.form1.Controls
Dim v = tbx.GetType
Dim b = GetType(Labirinto.tbxLabirinto)
If tbx.GetType Is GetType(Labirinto.tbxLabirinto) Then
Dim Num As Integer = CType(tbx.ID.Substring(12, 2), Integer)
If Num > 15 Then
CType(tbx, tbxLabirinto).Sopra = FindControl("tbxLabirinto" & Num - 5)
End If
If Num < 31 Then
CType(tbx, tbxLabirinto).Sotto = FindControl("tbxLabirinto" & Num + 5)
End If
If Num <> 11 And Num <> 16 And Num <> 21 And Num <> 26 And Num <> 31 Then
CType(tbx, tbxLabirinto).Sinistra = FindControl("tbxLabirinto" & Num + 1)
End If
If Num <> 15 And Num <> 20 And Num <> 25 And Num <> 30 And Num <> 35 Then
CType(tbx, tbxLabirinto).Destra = FindControl("tbxLabirinto" & Num + 1)
End If
End If
Next
End Sub
grazie della risposta,vedo se riesco a farlo nel tuo modo che mi sembra migliore.
Devo fare in modo che si autorisolva pure, l'unico modo è con una funzione ricorsiva come quella degli alberi no?