Results 1 to 4 of 4

Thread: Custom property

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2007
    Location
    indiana
    Posts
    341

    Custom property

    this is the code for my property

    Code:
    Dim _playernumber As Integer
    
        Property Player() As Integer
            Get
                _playernumber = _playernumber
            End Get
            Set(ByVal value As Integer)
                _playernumber = value
            End Set
        End Property
    The problem is that when i goto edit the player property at design time it always resets to 0. i know the problem has to do with the _playernumber = _playernumber part but i dont know what to change it to to fix it? any ides or suggestions?

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Custom property

    It should be:

    Code:
    Get
         Return _playernumber
    End Get

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2007
    Location
    indiana
    Posts
    341

    Re: Custom property

    Yup that worked thanks!

  4. #4
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Custom property

    For common things like inserting property definitions etc., visual studio provides predefined set of code snippets.
    You can right click anywhere in the code editor, click "Insert Snippet" and select the snippet you want to enter.

    Name:  codesnippet.JPG
Views: 88
Size:  46.2 KB

    Pradeep
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

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