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:
00834132
Vues:
23
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...

+++ Rick ---

>>I want to cast
>>
>>"label" + Convert.ToString(i)
>>
>>into a System.Windows.Forms.Label so that I can use
>>
>>MessageBox.Show(x.Text);
>>
>>How can I do that?
>
>Why do you want to cast it into a label for the message box?
>
>Can't you just use:
>MessageBox.Show(new String("label" + Convert.ToString(i)));
>
>Or do you have other reasons.
>
>Either way, if you want it to be a label, just create a Label object and set the text property to the string value.
+++ 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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform