How to set visibility on public property in VB.NET

1.5k Views Asked by At

I am maintaining some old code, I am a c# developer.

We have a usercontrol with a tablecell that I want to hide with my code on my other aspx page. It is reference and all that good stuff.

But how do you write a property to set visibility in vb.net.

Something like this, but not working.

    Public Property vis As TableCell
    Get
        LogoArea.Visible = False
    End Get
    Set(value As TableCell)
        LogoArea.Visible = True
    End Set
    End Property
1

There are 1 best solutions below

0
Brian Mains On BEST ANSWER

Use this instead:

Public Property LogoVisible As Boolean
    Get
        Return LogoArea.Visible
    End Get
    Set(value As Boolean)
        LogoArea.Visible = value
    End Set
End Property

This wraps around the Visible property of the LogoArea cell. Assuming it's a TableCell from your previous example, which is the web controls version, not the HtmlControls version.