如何禁用和数据库fields..VB.NET取消选中该复选框值 [英] How to disable and uncheck the checkbox values from database fields..VB.NET
本文介绍了如何禁用和数据库fields..VB.NET取消选中该复选框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经检索复选框选中值和放大器;放在文本框为1,2,3,4,5 ......等等......并插入到数据库中...用vb.net
有一个在我的数据库..
名称检查日期
萨米特3,2 11日 - 12月2010
马尼什1,5,4 11日 - 12月2010
Dobriyal 1,2,3,4 12日 - 12月2010
我想,当我搜索的11 - 12月,2010年的记录,然后框1,checkbox2,checkbox3,checkbox4,checkbox5将取消选中并禁用了11 - 12月-2010 ...
解决方案
暗淡检查=从选在db.Table其中chosen.date =11/10/2010选择选择。检查
点心盒作为新名单(串)
对于每个项目的检查
boxes.addrange(item.split(,C))
下一个
昏暗的BoxNums =从boxnum在盒子鲜明的选择复选框+ CSTR(boxnum)
对于每个但由于复选框YourForm.Controls
对于每个boxname作为字符串在boxnums
如果but.Name = boxname然后
but.Checked =假
but.Enabled =假
结束如果
下一个
下一个
I have retrieved checkbox checked values & put in textbox as 1,2,3,4,5...so on ...and inserted into database ... using vb.net
Have a look at my database ..
Name checked Date
Sumit 3,2 11-Dec-2010
Manish 1,5,4 11-Dec-2010
Dobriyal 1,2,3,4 12-Dec-2010
I want when I search for the record of 11-Dec-2010 then checkbox 1, checkbox2, checkbox3, checkbox4, checkbox5 will be unchecked and disabled for 11-Dec-2010...
解决方案
Dim checked = From chosen in db.Table Where chosen.date = "11/10/2010" Select chosen.checked
Dim boxes as new List (of string)
For each item in checked
boxes.addrange(item.split(","c))
Next
Dim BoxNums = From boxnum in boxes Distinct Select "checkbox" + Cstr(boxnum)
For Each but As CheckBox In YourForm.Controls
For Each boxname As String In boxnums
If but.Name = boxname Then
but.Checked = False
but.Enabled = False
End If
Next
Next
这篇关于如何禁用和数据库fields..VB.NET取消选中该复选框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文