วันอังคารที่ 9 มิถุนายน พ.ศ. 2552

Keyword : Me

Me

The Me keyword provides a way to refer to the specific instance of a class or structure in which the code is currently executing. Me behaves like either an object variable or a structure variable referring to the current instance. Using Me is particularly useful for passing information about the currently executing instance of a class or structure to a procedure in another class, structure, or module. For example, suppose you have the following procedure in a module:

Sub ChangeFormColor(ByVal FormName As Form)
Randomize()
FormName.BackColor = Color.FromArgb(Rnd() * 256, Rnd() * 256, Rnd() * 256)
End Sub

You can call this procedure and pass the current instance of the Form class as an argument using the following statement:

ChangeFormColor(Me)

The Me keyword is used in these contexts:


ที่มา : http://msdn.microsoft.com/en-us/library/7e58sbke(VS.71).aspx

>>Visual Basic Language Keywords here<<


0 ความคิดเห็น: