如何在表单pageload中隐藏已经选中的复选框? [英] how to hide already selected checkbox in form pageload?

查看:77
本文介绍了如何在表单pageload中隐藏已经选中的复选框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单中有20个复选框...现在我选择五个复选框并将该文本存储在数据库中然后如果我再次运行该程序我想隐藏已经选中的复选框?如何编写代码?

解决方案

我们不能具体,因为很多都取决于你如何存储信息,如何显示复选框等等。

如果我假设您的Twenty复选框在运行时动态添加到表单中,那么您的商店会在数据库中添加一个复选框编号,这很简单:从DB读取值并将其存储在列表< int> - 当您创建复选框时,查看列表是否包含数字,如果是,则将CheckBox.Visible(或可能更好的CheckBox.Enabled)设置为false。



A如果它们是静态的并且在设计时添加,则会使用类似的过程,但是增加的复杂性需要您设置要检查的复选框的数组或列表,或者运行容器对象控件集合以查找相应的条目

i have twenty checkboxes in my form...now i select five checkbox and store that text in database then if i again run that program i want to hide that already selected check boxes? how to write coding?

解决方案

We can't be specific, as a lot of it depends on how you store your info, how you display the checkboxes and so forth.
If I assume that your "Twenty checkboxes" are dynamically added to the form at run time an your store a checkbox number in the database then it's simple: read the values from the DB and store them in a List<int> - when you create the checkbox, see if the list contains the number and if so set the CheckBox.Visible (or probably better CheckBox.Enabled) to false.

A similar process would be used if they are static and added at design time, but with the added complication that you need to either set up an array or list of the checkboxes to check, or run through the container objects Controls collection to find the appropriate entry.


这篇关于如何在表单pageload中隐藏已经选中的复选框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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