473,597 Members | 2,050 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 10769
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
12508
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
6766
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
2462
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
1559
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
1662
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
2135
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
2249
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
7885
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
8380
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
8031
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
6686
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...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5426
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3881
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...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.