将CheckBox设置为未选中 [英] Set the CheckBox to Unchecked

查看:116
本文介绍了将CheckBox设置为未选中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Form1有10个以上的复选框



如何将所有复选框设置为未选中





My Form1 have above 10 Checkbox

how can I set the all checkbox to Unchecked


Dim xControl As Control
For Each xControl In me.Controls

   If TypeOf xControl Is TextBox Then
      xControl.ResetText()
   End If

   If TypeOf xControl Is CheckBox Then
      DirectCast(xControl , CheckBox).CheckState = CheckState.Unchecked
   End If

   If TypeOf xControl Is RadioButton Then
      DirectCast(xControl , RadioButton).Checked = False
   End If

   If TypeOf xControl Is ComboBox Then
      xControl.ResetText()
   End If

Next





这是我最后的接受解决方案



That is my last Accept Solution

推荐答案

这样的事情会这样做

Something like this would do it
For Each Control In Me.Controls
    If TypeOf (Control) Is CheckBox Then
        Dim work As CheckBox = Control
        work.Checked = False
    End If
Next


查看此信息: http://www.vbforums。 com / showthread.php?649278-Uncheck-all-CheckBoxes [ ^ ]


Dim xCheckBox As Control
For Each xCheckBox In Me.Controls
   If TypeOf xCheckBox Is CheckBox Then
      Dim work As CheckBox = CType(xCheckBox , CheckBox)
      work.Checked = False
   End If
Next


这篇关于将CheckBox设置为未选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆