简体   繁体   English

如何在VB.NET中设置公共属性的可见性

[英]How to set visibility on public property in VB.NET

I am maintaining some old code, I am ac# developer. 我正在维护一些旧代码,我是ac#开发人员。

We have a usercontrol with a tablecell that I want to hide with my code on my other aspx page. 我们有一个带有表格单元格的用户控件,我想用其他aspx页面上的代码将其隐藏。 It is reference and all that good stuff. 它是参考以及所有这些好东西。

But how do you write a property to set visibility in vb.net. 但是,如何编写属性以设置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

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. 这将环绕LogoArea单元的Visible属性。 Assuming it's a TableCell from your previous example, which is the web controls version, not the HtmlControls version. 假设它是上一个示例中的TableCell,它是Web控件版本,而不是HtmlControls版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM