此值必须为.visible = True
但是......
Public Property Active_bool As Boolean
Get
Return btn_Begin.Visible
End Get
Set(ByVal value As Boolean)
btn_Begin.Visible = value
End Set
End Property
我无法使用下拉框更改属性值。它实际上不会选择True!所以我必须更改designer.vb中的代码,但只要我查看我的form1设计器,值就会变回False!
是否有办法为此属性设置默认值?
该属性用于查看UserControl上的按钮是否可见。如果它可见,那么它将启动一个子。
Private Sub btn_Start_All_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Start_All.Click
Dim allActiveUserControls =
From uc_Index In Controls.OfType(Of LapTimerGUI)()
Where uc_Index.Active_bool
For Each User_Control In allActiveUserControls
User_Control.Start_Race()
Next
End Sub
答案 0 :(得分:2)
你可以尝试这个,但我必须问什么是环境(Winform,WebForm)以及这个属性的目的是什么?
dim _isEnabled = true
Public Property IsEnabled As Boolean
Get
Return _isEnabled
End Get
Set(ByVal value As Boolean)
_isEnabled = value
btn_Begin.Visible = _isEnabled
End Set
End Property