Previous | Index | Next 

Runtime-only properties

A VB6 user control can include one or more properties that are available only at runtime and that shouldn’t appear in the property window. By convention, such a property should raise error 382 or 387 in the Property Get procedure, as in:

        Property Get hWnd() As Long
            If Not Ambient.UserMode Then Err.Raise 382
            ' …
        End Property

During the conversion to VB.NET, such properties should be marked with the Browsable(False) attribute to hide them in the property window, and with the DesignSerializationVisibility(DesignerSerializationVisibility.Hidden) attribute to avoid persistence in the designer. VB Migration Partner correctly detects this situation and generates these attributes as needed.

 

Previous | Index | Next