vb.net - Set checkbox value to true if Data in Datagridview exist else False -


i have program , looks this

enter image description here

my target here how can set value of checkbox true if name exist , value = true or else false

i have code not working

    each dr datagridviewrow in me.datagridview1.rows                 if dr.cells(0).value.tostring = "button2" , dr.cells(1).value.tostring = "true" checkbox23.checked = true else checkbox23.checked = false  , on . . . . . . . . . . .             next         end sub 

any appreciated tysm

found answer

  public function enablebypermission(byval buttonname string) boolean         dim enable boolean = false          ' on enumerable collection of rows 1         ' cell controlname contains button name required         dim row = datagridview1.rows _                   .cast(of datagridviewrow)() _                   .firstordefault(function(x) _                       x.cells("controlname").value.tostring = buttonname)           ' if found return boolean value access column               if row isnot nothing             enable = convert.toboolean(row.cells("access").value)         end if         return enable     end function     private sub form7_shown(byval sender object, byval e system.eventargs) handles me.shown         checkbox23.checked = enablebypermission("button2")     end sub 

Comments

Popular posts from this blog

php - isset function not working properly -

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -