Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This 'ME' thing
Message
 
À
08/01/2013 10:10:14
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01561723
Message ID:
01563145
Vues:
51
>Ok...this whole 'ME' thing that VB has going on is very confusing.
>
>I'm working in a TextBox_TextChanged event handler
>
>I get the whole 'ME' here refers to the TextBox, so, one would think, if I wanted to change the text of a label (lblStudentName) I would refer to it as me.parent.lbl, but it doesn't seem to like that. It wants me.lblStudentName.Text. It seems to kinda act like the royal 'we'.
>
>
>This is very confusing and is there a better way to refer to other controls on the form other than Form.lbl...?

Most controls in .NET forms don't use a containership-model (like VFP does). All controls are actually just properties added to the form, even if they appear "inside" another control. (NOTE: that's not absolutely true everywhere); take a look at the code in the .designer files to see this. Another stumbling point is that, inside of a delegate (event), Me/this usually doesn't refer to the control that raised the event. That's why the event signature usually passes the source of the event as the first parameter.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform