|
-
Oct 5th, 2005, 10:51 AM
#1
Thread Starter
Fanatic Member
[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
-
Oct 5th, 2005, 12:11 PM
#2
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
-
Oct 5th, 2005, 12:12 PM
#3
Fanatic Member
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
it works 60% of the time, all the time.
-
Oct 5th, 2005, 02:31 PM
#4
Thread Starter
Fanatic Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|