473,320 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

MyBase versus Me

Hello,

Could somebody tell me what is the difference between MyBase and Me?
For example, should I use

Page_Init(....) Handles MyBase.Init

Or

Page_Init(....) Handles Me.Init

Thanks,
Miguel

Nov 8 '06 #1
2 4170
MyBase gives you a reference to the base class (the class the current class
derives from) "Me" gives you a reference to the current class.
In C#, "base" and "this".
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"shapper" wrote:
Hello,

Could somebody tell me what is the difference between MyBase and Me?
For example, should I use

Page_Init(....) Handles MyBase.Init

Or

Page_Init(....) Handles Me.Init

Thanks,
Miguel

Nov 8 '06 #2
MyBase explictly calls the function from the base class.

Me calls the function from the current class.

The Handles example isn't a good one.

MyBase is particularly useful when you are overriding a base member.

public class Employee
private _employeeId as integer

public overridable function EmployeeCode() as string
return _employeeId.ToString()
end function
end class

public class Consultant
inherits Employee
private _consultantId integer

public overrides function EmployeeCode() as string
return MyBase.EmployeeCode() & _consultantId
end function
end class

MyBase let's you easily override an implementation without having to
re-write the code in the base method. You can do your stuff, then call
MyBase.XXX.

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@e3g2000cwe.googlegrou ps.com...
Hello,

Could somebody tell me what is the difference between MyBase and Me?
For example, should I use

Page_Init(....) Handles MyBase.Init

Or

Page_Init(....) Handles Me.Init

Thanks,
Miguel

Nov 8 '06 #3

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

Similar topics

5
by: DraguVaso | last post by:
Hi, I have my custom Inherited DataGrid. I override the OnPaint-event to speed up things and avoid flikkering using Double Buffering. To draw the normal things of the DataGrid I have to call the...
9
by: Dennis | last post by:
When a class (myownclass) inheirits another class, how can I get an object reference to the underlyng MyBase class instance from within myownclass. The base class has a method that I want to...
9
by: Henry Padilla | last post by:
I realize that MyBase.MyBase is illegal, so how DO I get to the Parent of MyBase? In Short what is the VB equivalent of "::"? Example: Class Component Inherits Hashtable
1
by: Support | last post by:
Hello: I have an application that I wish to update upon login via login script but since the application is in the start-up menu, I cannot override the exe, so, I wrote a function that iterates...
5
by: TheBee | last post by:
Hello, I have seen the following routines in a class and don't understand how they work. For one, why two new() routines? Which is executed? Why not just use one routine? What does the mybase...
4
by: Sugan | last post by:
Hi, i came across custom usercontrols in VB 2005 and i'm not clear about the difference between "Me" and "MyBase". 1. What is the difference between the two keywords in a UserControl. 2....
4
by: aj | last post by:
DB2 8.2 LUW FP14 Is there any real difference between select blahblahblah... where blah IN (select blah......) versus select blahblahblah... where blah = ANY (select blah.....) versus select...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.