Inherited properties are not editable in designer
I have a base form class that is providing a new property that looks Like this
Public Class BaseForm
Private _HappyTime As Boolean
Public Property HappyTime() As Boolean
Get
Return _HappyTime
End Get
Set(ByVal value开发者_Go百科 As Boolean)
_HappyTime = Value
End Set
End Property
End Class
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class BaseForm
Inherits System.Windows.Forms.Form
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
Private components As System.ComponentModel.IContainer
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Text = "BaseForm"
End Sub
End Class
Now when I inherit the BaseForm on a new form, the HappyTime property displays in the properties window as false, and is uneditable.
I've recreated this BaseForm and Inheriting Form in an entirely new soloution and, the HappyTime property is editable and works as expected. For some reason in the existing project (where these changes need to be made) it's not behaving properly.
This leads me to believe that it has something to do with the configuration of my project. Does anybody have any insight into this, short of creating a new project and moving all the code into it?
Environment Information: .Net Framework 3.5, Visual Studio 2010, Win7 x64
In the recreated solution, is the _HappyTime property Private or Protected? I think that if you just change it to Protected in this solution, it'll work.
精彩评论