Public Class Form1
Private Function AllEnabled(ByVal b As Boolean) As Boolean
For i As Integer = 0 To 2
Dim c As CheckBox = CType(Me.Controls("CheckBox" & i.ToString), CheckBox)
c.Enabled = b
Next
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Call AllEnabled(False)
End Sub
End Class
在(对象引用未设置b
为c.Enabled = b
对象的实例。)
但是当我使用checkbox1.enabled = b
而不是c.enabled = b
工作正常时。
所以当我看到错误不是b
正确的?
& 我怎样才能解决这个问题 ?