[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


What is exactly the Me?

Posted on 2009-02-16
Medium Priority
Last Modified: 2013-11-26

I need help understand the "me" in vb.net as in me.radiobutton1.
 Can you give examples please
What we need it?

Question by:jean11
LVL 53

Assisted Solution

Dhaest earned 90 total points
ID: 23649523
Provides a way to refer to the specific instance of a class or structure in which the code is currently executing

Source: http://msdn.microsoft.com/en-us/library/7e58sbke(VS.80).aspx
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 180 total points
ID: 23649546

The form instance that contains that radio button control.

You don't really need it but Intellisense pops up as soon as you type me.
LVL 16

Accepted Solution

HooKooDooKu earned 105 total points
ID: 23649991
It's the VB equivilent to the 'this' pointer in C++.

When you define a class or a form, it's possible to have multiple instances of that class or form.  To reference a specific instance from within the class or form, you used 'Me'.

There's not very many instances where 'Me' is needed, but the situation does arise.  

As a trivial example, the following code snippet calls a global function (defined outside of a form or class) to set caption of a form.  

'Global function to set a form's caption based on logic in another function
Public Sub SetMyCaption( F as Form )
  Dim Str as string
  Str = SomeOtherFunctionToDetermineFormCaption( F )
  F.Caption = Str
End Sub
'Logic in Form1 to change the Caption
Private Sub UpdateMyCaption
  SetMyCaption( Me )
End Sub

Open in new window


Author Comment

ID: 23650945
Thanks a lot.

but what is instance of a class? if my class is form1 then what is the instant of that?
also I will increase the point if some one answer the following questions please:

what is the difference between:
textbox1.select, and

LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 180 total points
ID: 23651013
You can have multiple copies of the Form1 object in memory.

dim f1 as new Form1
dim f2 as new Form1

f1 and f2 are called instances.

The Focus method gives the focus (move the cursor) to that control.

The Select method selects (highlights) a range of characters in the TextBox.

The SelectAll method selects all the characters.

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question