Results 1 to 5 of 5

Thread: custom classes [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    custom classes [RESOLVED]

    When you create your own class and you create your methods, it's better to reference the property instead of the variable when making changes to those. (this was from another thread).

    if you use the keyword ME.{property}..... will that cause problems later? or does it have to be ClassName.{property}?
    Last edited by Andy; Aug 13th, 2004 at 12:11 PM.

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    As I understand it, Me.PropertyName is OK and must be used where there is a variable and a field with the same name (which can be easily avoided). A problem arises if you override the member in the derived class, so you must not make it overridable.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  3. #3
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Me will always refer to the Class the property is located in.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Personaly I've always used the variable name, then there is no confusion as where the data is comming from/going to. Whether it's best practice or not, I don't know.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I usually go for the properties. That way, if I add any type of logic into the Property Set, I don't need to worry about differing results in other areas of the class.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width