
Originariamente inviata da
ArgonautaWEB
Salve
Mi sto divertendo con VB.net anche essendo inesperto. Però sto riempiendo il mio form di pultantini label ecc.. tutti con un nome un evento associato ecc...
Le righe di codice però diventano così ingombranti a morire
Come faccio ad alleggerire tutto con dei cicli For ?
Esempio, ho 5 oggetti Label:
txtLabel1,
txtLabel2,
txtLabel3, txtLabel4, txtLabel5
Se gli voglio cambiare testo faccio:
txtLabel1.Text = "Testo Inserito 1"
txtLabel2.Text = "Testo Inserito 2"
ecc...
ma diventano tante righe
Come faccio a fare lo stesso usando un ciclo For?
For i = 1 To 5
CosaScrivoQui?.Text = "Testo inserito " & i
Next