Results 1 to 3 of 3

Thread: VB .NET 2.0 MonoDevelop

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2006
    Location
    Florida, USA
    Posts
    565

    VB .NET 2.0 MonoDevelop

    I am trying to do a basic get and set in MonoDevelop, but I am not very familiar with how to do them. Please see the error and let me know what you recommend.
    vb Code:
    1. Public Property UseVisualStyleBackColor As Boolean
    2.         Get
    3.             Return UseVisualStyleBackColor
    4.         End Get
    5.         Set(value As Boolean)
    6.             UseVisualStyleBackColor = value
    7.         End Set
    8. end property
    WrappingRadioButton\UserControl1.vb(0,0): Warning BC42026: Expression recursively calls the containing property 'UseVisualStyleBackColor'. (BC42026) (WrappingRadioButton)
    Last edited by rex64; Feb 10th, 2012 at 02:37 PM.
    I use VB .NET 2022. Currently developing StudyX educational software, PlazSales POS system and Yargis a space ship shooter game.

  2. #2
    Hyperactive Member
    Join Date
    Jan 2007
    Posts
    351

    Re: VB .NET 2.0 MonoDevelop

    You need to declare another variable which the property returns and is set as its value.
    Rico

    Using: VB.net & MS SQL

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VB .NET 2.0 MonoDevelop

    umm... yeah... normally there's a private backing variable and you get and set that...like this:
    Code:
    Private mUseVisualStyleBackColor as Boolean 
    Public Property UseVisualStyleBackColor As Boolean
            Get
                Return mUseVisualStyleBackColor
            End Get
            Set(value As Boolean)
                mUseVisualStyleBackColor = value
            End Set
    end property
    because you had Return UseVisualStyleBackColor it would have caleld the property again, and again and again....

    -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