IT SOLUTIONS
Your TECHNOLOGY partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Languages
-Collapse +Expand Categories
-Collapse +Expand VB.Net Guides
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesVB.NetOOP Basics   

Self Keyword (Cross Ref > OOP Basics)

By Mike Prestwood

VB.Net versus VB Classic: A side by side comparison between VB.Net and VB Classic.

 
Language Details
 

Language Details is kind of a catch all for stuff that didn't make it into language basics nor any other category.

Self Keyword

[Other Languages] 
VB.Net:   Me

To refer to the current instance of a class or structure, use the Me keyword. Me provides a way to refer to the specific instance in which the code is currently executing. It is particularly useful for passing information about the currently executing instance.

The Me keyword is also used as a modifier of the first parameter of an extension method.

You cannot use Me with static method functions because static methods do not belong to an object instance. If you try, you'll get an error.

Syntax Example:  
Sub SetBackgroundColor(FormName As Form)
  //FormName.BackColor = ...some color
End Sub
  
//Pass Me.
SetBackgroundColor(Me)
VB Classic:   Me

The Me keyword is a built-in variable that refers to the class where the code is executing. For example, you can pass Me from one module to another.

Syntax Example:
Private Sub Command4_Click()
  MsgBox Me.Name 'Displays name of form (Form1 in this case).
End Sub












-
  Load Time=1 seconds.
 
Print This
-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


-
 
Connect With Us...
PrestwoodBoards
Join Us!
Facebook
Like our page!
Twitter
Follow us!
LinkedIn
Join Group
YouTube
View channel.
Go ahead!   Use Us! Call: 916-726-5675 


©1995-2013 Prestwood IT Solutions.   [Security & Privacy]   Made in the U.S.A..   No H1-B.   No offshoring.