如何制作一个按钮来控制所有复选框 [英] how to made a button to control all checkbox
本文介绍了如何制作一个按钮来控制所有复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个带有18个复选框
当表单加载所有复选框未启用时状态
所以我试图创建一个按钮立即启用所有复选框
复选框除了checkbox1.enabled = true之外还有其他方法吗?
我是尝试一个代码,但这段代码不起作用。它表示Object引用未设置为对象的实例。强调c.enabled = true
有人可以帮忙吗?
i'm making a from with 18 checkbox
when the form load all the checkbox is on not enabled state
so i'm trying to made a button to enable all the checkbox at once
is there any other way other than checkbox1.enabled=true for all the checkbox?
i'm trying one code but this code not working. it said Object reference not set to an instance of an object. underline on c.enabled=true
can anyone help, please?
For i As Integer = 0 To 18
Dim c As CheckBox = CType(Me.Controls("CheckBox" & i.ToString), CheckBox)
c.Enabled = True
Next
推荐答案
For Each c In Me.Controls.OfType(Of CheckBox )
c.Enabled = True
Next
这篇关于如何制作一个按钮来控制所有复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文