Results 1 to 4 of 4

Thread: defining properties[SOLVED]

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2010
    Posts
    24

    Unhappy defining properties[SOLVED]

    I am new in VB 2012, coming from VBA

    When defining properties, I wonder if there is any simplication to avoid the verbose definition of all private variables and all the property get/set declarations. Imagine a class with 30 properties.. a lot of typing!!
    thanks
    Last edited by amc4042; Aug 21st, 2014 at 02:14 PM.

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: defining properties

    When you have already typed PROP you just have to press the Tab twice then just modify the different parts of the Property.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3
    Frenzied Member
    Join Date
    May 2014
    Location
    Central Europe
    Posts
    1,372

    Re: defining properties

    or you can use this if its simple getter/setter:

    Code:
    public property xy as string
    it looks like public var but it gets compiled to a property

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: defining properties

    That's the method I use... only time I deviate from that is when I need some logic behind it.

    It's also probably worth noting this only works in VB2010 and newer (2012 & 2013) ... for earlier versions you still need to use the verbose method. Dee-U's method does help aleviate some of that though.

    -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??? *

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