[RESOLVED] Resolve Control name on the fly?
Don't think that the best title...
Does anyone know how to resolve object names on the fly
e.g. I have 6 controls called
mybox1
mybox2
mybox3
...
when the form is submitted I want to look though them creating a list
VB Code:
Dim mystring as string
for i = 1 to 6
mystring += mybox+i.tostring.trim + ","
next
'Save myString to DB
Re: Resolve Control name on the fly?
Is this a clue?
VB Code:
Dim txtTemp As New TextBox
For i As Integer = 0 to 6
mystring &= CType(Page.FindControl("mybox" & i.ToString()), TextBox) & ","
Next i
Re: Resolve Control name on the fly?
does it have anything to do with execute scalar,
i always seem to ned to use that for values
im a newbie and i know this prob wont help u sry
Re: Resolve Control name on the fly?
Mendhak,
Thanks for the tip
This seems to work
VB Code:
Dim myStr As String = vbNullString
Dim txtTemp As New TextBox
For i As Integer = 1 To 3
txtTemp = CType(Page.FindControl("txtName" & i.ToString()), TextBox)
myStr += txtTemp.Text.ToString.Trim & ","
Next i
Response.Write("Returned Vals: " & myStr)
I've tried giving you kudos on a few occasions but I keep getting told I need to spread my love around first.
Much obliged anyway
Cheers Al