PropertyGrid无法正常工作?

时间:2014-12-27 00:08:45

标签: vb.net winforms propertygrid .net-4.5.2

我有这个课程,我希望它可以通过PropertyGrid控件进行编辑。

Class ConfigurationValues
    Public UpdateCapital As Boolean = False
    Public verbosity As VerbosityLevel = VerbosityLevel.e0_StrategyInformation
    Enum VerbosityLevel
        e0_StrategyInformation
        e1_HighLevel
        e2_BaseRoutines
        e3_Confirmations
        e4_AlmostAll
        e5_EveryThing
    End Enum
End Class

这是我的表格。

    Public Class Form1
        Dim config As New ConfigurationValues
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
            PropertyGrid1.SelectedObject = config
        End Sub
    End Class

问题在于,PropertyGrid保持空白。

有人可以启发我吗?

1 个答案:

答案 0 :(得分:0)

PropertyGrid查找属性。我也将Enum更改为更具可读性 - 尽管如此。

Public Class ConfigurationValues
  Public Property UpdateCapital As Boolean = False
  Public Property verbosity As VerbosityLevel = VerbosityLevel.StrategyInformation
  Public Enum VerbosityLevel
    StrategyInformation
    HighLevel
    BaseRoutines
    Confirmations
    AlmostAll
    EveryThing
  End Enum
End Class

MSDN

Code Project