如何禁用和数据库fields..VB.NET取消选中该复选框值复选框、数据库、VB、fields

2023-09-02 02:05:47 作者:过去过不去的都会过去

我已经检索复选框选中值和放大器;放在文本框为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 =假
        结束如果
    下一个
下一个
 

求 vb.net winform datagridview 中复选框多项删除实例 希望有的不要吝啬,扶持下我们这些菜鸟

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