Hi @Sani Love ,
Both solutions you mentioned are valid, but they serve different purposes:
-
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
This combination of attributes (Browsable, EditorBrowsable, and DesignerSerializationVisibility) hides the property in different contexts:Browsable(False)
: Hides the property from the Property Grid in the Visual Studio designer.EditorBrowsable(EditorBrowsableState.Never)
: Hides the property from IntelliSense and code completion.DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
: Prevents the property from being serialized into the designer code. -
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never)>
This combination of attributes hides the property from the Property Grid and from IntelliSense, but it doesn't prevent it from being serialized into the designer code.
In your case, if you want to completely hide the property from being shown in the Property Grid and prevent its serialization into the designer code, you should use the first combination with all three attributes.
Within the control's methods or constructor, you can set the properties just like any other property, using Me.MyProperty = False
(or whichever value you want to set).
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.