473,663 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4191
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.ToS tring()
end function
end class

public class Consultant
inherits Employee
private _consultantId integer

public overrides function EmployeeCode() as string
return MyBase.Employee Code() & _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******** *************@e 3g2000cwe.googl egroups.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
2422
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 MyBase.OnPain(pe). But in my opinion it doesn't seem to be painted on the buffer. Everything works fine, but I think it should work better if my MyBase.OnPaint also painted in my buffer. Am I wrong? And how should I do this? I kind of need to...
9
2101
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 utilize in myownclass but the method is private and can't be inheirited. I need to utilize that base class method. -- Dennis in Houston
9
9245
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
1179
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 through all the instances of this application and kills the one instance that is not itself and then shuts itself down. The idea is that in a batch file , I could run <applicationname> shutdown which would create a new instance of the...
5
2315
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 do in this case? Bit confusing! :) Thanks '<remarks/> Public Sub New() MyBase.New() Me.Url =
4
11874
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. Even if they are different, is there any harm in using it interchangeably?
4
8338
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 blahblahblah... where exists (select blah.....) Is one more ANSI than another? Which is most portable?
0
8436
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
8858
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
8771
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
8548
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
8634
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
4182
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
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
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
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.