我已经检索复选框选中值和放大器;放在文本框为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