Windows Forms Windows10 VB.NET2017 です Enumでの方法とapperaranceの方法うまくいきました ありがとうございます。 Enumの方法だと、整数値しかもたせることしかできないので StructureやClassを使いたいと考えています。 Public Structure sss Property afd As String End Structure Public Class CustomControl1 Private _FFF As sss Public Property FFF() As sss Get Return Me._FFF End Get Set(value As sss) Me._FFF = value End Set End Property End Public とすると、コントロールのプロパティ上に、 FFFという項目が表れます。 しかし、WindowsApplication1.sss と表示されたままグレー色になっており、 数値を変更できないようになっています。 あと、ところで気づいたのですが 今まで、 Private _Type As CustomType Public Property Type As CustomType Get Return Me._Type End Get Set(value As CustomType) Me._Type = value End Set End Property というような書き方をしていたのですが Public Property Type As CustomType でもうまくいくことに気がつきました。 GetやSetを明示的に書くメリットは何なのでしょうか?
- Child Tree -