Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I cast a string into an Object
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00832051
Message ID:
00834651
Vues:
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.

My background is in protocol communications with hardware devices, firmware, and other overly structured environments so I guess I never have run into a use for anything that I didn't have planned out. My first reaction to a dynamic interface would be to create a hash lookup for the objects and store references to them, but since I come from the C++ world that would normally be the only logical solution. With getting into Visual Foxpro a little and .NET a lot I am seeing a lot of the many ways the langauges allow programmers to handle tasks and each one has its advantages and disadvantages.

It makes senses I guess with utilizing dynamic access to objects in which you don't know the names of properties at design time or at least want the ability to adjust at run time.

Its nice to see multiple perspectives on things though and adds to my list of mental notes of different approaches to a problem.
Brian Seekford
Seekford Solutions, Inc.
http://www.SeekfordSolutions.com
Internet ActiveX Controls and .NET Class Libraries.
SMTP/S FTP POP3/S HTTP/S SNTP MIME PING WHOIS TRACEROUTE NNTP DNS MX
Base64, UUEncode, yEnc, MD5, SHA1, URL, Quoted-Printable.
Resizer and Tooltips
Email Verification and more. Check us out!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform