build variable name programmatically

  • Thread starter Thread starter Lenny
  • Start date Start date
L

Lenny

hi

I have 10 textboxes in a form named a1, a2, a3, a4,..... a10
when I press a button I want to perform 10 queries. every query should use
the value in a text box
how can I do it?
here is my code.
how can I let the "a" variable assume the value of the a1..a10 textboxes?
For i = 1 To 10
a = a1.Text
SqlDataSource3.InsertParameters.Add("movimento", id)
SqlDataSource3.InsertParameters.Add("importo", a)
SqlDataSource3.InsertParameters.Add("sessione",
Session.SessionID)
SqlDataSource3.Insert()
Next

thanks
Lenny
 
how can I let the "a" variable assume the value of the a1..a10 textboxes?
For i = 1 To 10

Use FindControl
a = a1.Text
a = ((TextBox)FindControl("a" & i.ToString)).Text

Apologies if that syntax isn't exactly correct - I never go anywhere near
VB.NET...
 
Back
Top