Me Keyword


Me Keyword

Syntax

     Me 

Description

The Me keyword represents a reference to the current class from within the class.

Usage at a Glance

  • Me is an explicit reference to the current class or type as defined by the Class...EndClass construct or similar construct.

  • Me is particularly useful when passing an instance of the current class as a parameter to a routine outside the class.

Example

This example shows how the Me keyword can be used to access class elements masked by local variables with the same name.

     Public Class TestClass        Private sampleData As Integer        Private Sub CheckTheData(  )           Dim sampleData As String = "abc"           Me.sampleData = 5           MsgBox(sampleData)       ' Displays "abc"           MsgBox(Me.sampleData)    ' Displays "5"        End Sub     End Class 

See Also

MyBase Keyword, MyClass Keyword




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net