Slight change...
This is untested but it might be possible to make a new text box, set the
name, and then access with that name. Something like:
Dim curBox as TextBox
While dtrcondet.Read
curBox = new TextBox()
curBox.Name = dtrcondet.item("contact_detail_description")
Me.Controls.Add(curBox)
WEnd
You might then be able to access it by saying something like:
Me.Controls(dtrcondet.item("contact_detail_description"))
However:
You need to decide how to handle duplicate [name] values, and you'll need
to
check for invalid characters - I can't remember if there are characters
that
can't be used for names. It would still probably be best to use the .tag
property as previously discussed. How are you reading the values back in?
There are slightly differing options depending on whether it's a Win or
Web
form.
Jevon
Is this a .net app? E.g. .ASPX? If so, this should really be posted in
microsoft.public.dotnet.framework.aspnet, or
microsoft.public.dotnet.languages.vb if it's a general thing - your
post
isn't clear.
What you want to do isn't possible. However, a work around would be to
have a hashtable that you add the items to. When you make a new
textbox,
you set the TAG property to the value of
dtrcondet.item("contact_detail_description"), then you can look in the
hashtable for the corresponding value. However, you might not even need
the hashtable, you could just use the TAG value.
Sorry if that's a bit unclear, but I can't figure out why you'd want
dynamic text boxes in that manner anyway, or what you're trying to do
with
them
Jevon
I want to create textboxes dynamically but with dynamic names also.
i am retrieveing a load of values from a table in SQL into a
DataReader.
Then i want to create textboxes from those variables. I want to dim
various
textboxes with different names depending on what I retrieve from SQL.
I
tried the following:
dim dtrcondet.item("contact_detail_description") as new textbox()
but this does not work
Can anyone help?