Visual Basic Language Reference  

Me

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

Sub ChangeFormColor(FormName As Form)
   FormName.BackColor = RGB(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)

See Also

Object Variable Assignment | MyBase | MyClass