473,652 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When and Why use "Me."?

Hello,

I realize that this is a very basic question but is there an advantage to
using Me.ControlName. Text over just using ControlName.Tex t? I have been
leaving the Me. off but would include it if there are benefits.

Thanks,
Richard
Nov 21 '05 #1
14 10776
Me is a handy reference if you cant remember the object name, intellisense
will give you a list.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
"Richard Thornley" <rh**@thorsoft. com> wrote in message
news:ev******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

I realize that this is a very basic question but is there an advantage to
using Me.ControlName. Text over just using ControlName.Tex t? I have been
leaving the Me. off but would include it if there are benefits.

Thanks,
Richard

Nov 21 '05 #2
Richard,

Me is mostly just used as an easy shortcut to intelisence, for the rest it
makes no sense with the little exception when there is an ambigious name
used in your program. Than you can use it as well to make that name unique.
I think that a better name had been My. It are all things that directly
belongs to the class. However I am not a person wich native language is
English so I have to be a little bit carefull with telling this.

I hope this helps?

Cor

"Richard Thornley" <rh**@thorsoft. com>
Hello,

I realize that this is a very basic question but is there an advantage to
using Me.ControlName. Text over just using ControlName.Tex t? I have been
leaving the Me. off but would include it if there are benefits.

Thanks,
Richard

Nov 21 '05 #3
Thank You for the explaination. That is what I thought it was for but
sometimes a simple answer is difficult to find in a manual or book.

Cheers,

Richard

"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Me is a handy reference if you cant remember the object name, intellisense
will give you a list.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
"Richard Thornley" <rh**@thorsoft. com> wrote in message
news:ev******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

I realize that this is a very basic question but is there an advantage to
using Me.ControlName. Text over just using ControlName.Tex t? I have been
leaving the Me. off but would include it if there are benefits.

Thanks,
Richard


Nov 21 '05 #4
Thank You for the explaination. That is what I thought it was for but
sometimes a simple answer is difficult to find in a manual or book.

Cheers,

Richard

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:OD******** ******@TK2MSFTN GP10.phx.gbl...
Richard,

Me is mostly just used as an easy shortcut to intelisence, for the rest
it makes no sense with the little exception when there is an ambigious
name used in your program. Than you can use it as well to make that name
unique. I think that a better name had been My. It are all things that
directly belongs to the class. However I am not a person wich native
language is English so I have to be a little bit carefull with telling
this.

I hope this helps?

Cor

"Richard Thornley" <rh**@thorsoft. com>
Hello,

I realize that this is a very basic question but is there an advantage to
using Me.ControlName. Text over just using ControlName.Tex t? I have been
leaving the Me. off but would include it if there are benefits.

Thanks,
Richard


Nov 21 '05 #5
Couldn't Me also be substituted for MyClass?
"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Me is a handy reference if you cant remember the object name, intellisense
will give you a list.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
"Richard Thornley" <rh**@thorsoft. com> wrote in message
news:ev******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

I realize that this is a very basic question but is there an advantage to using Me.ControlName. Text over just using ControlName.Tex t? I have been
leaving the Me. off but would include it if there are benefits.

Thanks,
Richard


Nov 21 '05 #6
The "me" reference exists so that an object can pass references of itself to
other classes and methods.

using me.member (etc) is handy for Intellisence (as people have already
noted), but it may also speed up compilation time, as the compilier doesn't
have to look through the entire symbol table to resolve the entry.

"Richard Thornley" wrote:
Hello,

I realize that this is a very basic question but is there an advantage to
using Me.ControlName. Text over just using ControlName.Tex t? I have been
leaving the Me. off but would include it if there are benefits.

Thanks,
Richard

Nov 21 '05 #7
Yes, good point MyClass enables you to refer to the current object.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
"Richard Thornley" <rh**@thorsoft. com> wrote in message
news:OS******** *****@TK2MSFTNG P15.phx.gbl...
Thank You for the explaination. That is what I thought it was for but
sometimes a simple answer is difficult to find in a manual or book.

Cheers,

Richard

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:OD******** ******@TK2MSFTN GP10.phx.gbl...
Richard,

Me is mostly just used as an easy shortcut to intelisence, for the rest
it makes no sense with the little exception when there is an ambigious
name used in your program. Than you can use it as well to make that name
unique. I think that a better name had been My. It are all things that
directly belongs to the class. However I am not a person wich native
language is English so I have to be a little bit carefull with telling
this.

I hope this helps?

Cor

"Richard Thornley" <rh**@thorsoft. com>
Hello,

I realize that this is a very basic question but is there an advantage
to using Me.ControlName. Text over just using ControlName.Tex t? I have
been leaving the Me. off but would include it if there are benefits.

Thanks,
Richard



Nov 21 '05 #8
Yes, good point MyClass enables you to refer to the current object.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:eH******** ******@TK2MSFTN GP09.phx.gbl...
Couldn't Me also be substituted for MyClass?
"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in
message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Me is a handy reference if you cant remember the object name,
intellisense
will give you a list.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
"Richard Thornley" <rh**@thorsoft. com> wrote in message
news:ev******** ******@TK2MSFTN GP10.phx.gbl...
> Hello,
>
> I realize that this is a very basic question but is there an advantage to > using Me.ControlName. Text over just using ControlName.Tex t? I have been
> leaving the Me. off but would include it if there are benefits.
>
> Thanks,
> Richard
>



Nov 21 '05 #9
"Richard Thornley" <rh**@thorsoft. com> schrieb:
I realize that this is a very basic question but is there
an advantage to using Me.ControlName. Text over just
using ControlName.Tex t? I have been leaving the Me.
off but would include it if there are benefits.


Consider this example:

\\\
Private Foo As Integer = 77

Private Function Test() As Integer
Dim Foo As Integer = 99
Return Me.Foo + Foo
End Function
///

;-)

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
12511
by: Nuno | last post by:
Is there any SQL Error? Or I have to use Select case in VB code to control SQL instead. Thank you for any ans. Nuno
3
2116
by: Phil | last post by:
Hi everybody, I am a XSLT beginner and the following problem really makes me crazy ! I have a main "contacts.xml" document which contains references to several contact data XML files. My aim is to process the contacts in a single-pass XSLT process. That is why the "document()" function is what I need. I call the "document()" XPath function from a "for-each" instruction.
1
6773
by: RC | last post by:
If I want to explicitly save the record before executing a Close action. Which of the following should I use? Or does it depend on whether it is based on a Form or something else? If Me.Dirty Then RunCommand acCmdSaveRecord End If DoCmd.Close or
1
3072
by: RzB | last post by:
In a previous post in this NG (Oct 98) http://makeashorterlink.com/?D505347FB Henry Craven says that he was investigating a relationship between the presence or absence of a "Me!" prefix, the value of the Top propery of a control, and the occurrence of an invalid runtime error "The control or subform control is too large for this location"
11
2468
by: Ayende Rahien | last post by:
I've a really strange problem, in some part of my code I compare two strings (through object), and while I *know* that they equal each other, and in the watch window they do equal each other, then the comparision return false. See here for details: http://www.ayende.com/Blog/PermaLink,guid,f5aa1a11-1710-434f-bfe0-39ac876a6acb.aspx
5
1566
by: Agnes | last post by:
For my own practices. I like to put "Me". e.g IF Me.txtInvoice.textlength = 0 ....... etc Me.txt.....etc However, Is there any difference (without Me) ?? Thanks
6
1664
by: John | last post by:
Hi, Maybe someone can explain the use of "Me" to me? The example class CPoint3 uses the Me reference in the output statement: Console.WriteLine("CPoint3 constructor: {0}", Me) The text states: "This implicitely invokes the class's ToString method". This would be clear if Me.ToString was used, which I tested and works too!. Actually, Me.Anything works and gives the same results as long as Anything is a class member.
11
2141
by: comp.lang.php | last post by:
function blah($item) { if (!isset($baseDir)) { static $baseDir = ''; $baseDir = $item; print_r("baseDir = $baseDir\n"); } $dirID = opendir($item); while (($fyl = readdir($dirID)) !== false) { if (is_dir("$baseDir/$fyl")) blah($item);
1
2263
by: Ray | last post by:
Hello, Please help a VB newbie :) I'm a bit confused, reading all the MyClass, Me, My keywords of VB. I think I get MyClass and My, but Me... Can you just tell me if I get this correctly? "Me" in VB (6, 7, 2005) is exactly like "this" in C# or C++. Its meaning hasn't changed since VB 6. True or False? Many thanks,
0
8367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8279
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8703
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8589
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.