Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I cast a string into an Object
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00832051
Message ID:
00834587
Views:
18
>>I think the point is to dynamically access the label at runtime not the string "label1" etc. In addition to using Reflection you can also use the Control collections to find controls by name...
>
>That would make more sense then. The iteration of the collection is highly efficient but should serve the purpose. I wonder what reason he has against using the variable for the label itself? It would interesting to know.

Have you never wanted to dynamically access a label or textbox before? :-} For example, if you have a form where you dynamically add controls at runtime you have no idea how many there are until you've built it, so you dynamically need to access it.

It's basic Eval functionality - if you come from a VFP background you sorely miss it at times (although you can easily work around it with .Net with a little code). I agree, it's not very often that this sort of thing is needed with textboxes or labels and the control collection is a better way to do this too I suppose, but it very frequently needed with properties of a form or object.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform