vb.net - Get the text from a check box list -


i have check box list in winform.

if check box list selected want value passed string:

for integer = 0 cbxlstpancakes.items.count - 1     if cbxlstpancakes.getitemchecked(i)          dim currentpancake string = cbxlstpancakes.selecteditem.tostring      else         'do if not checked.     end if next 

now i'm confused if you're using strings vs. bound datasource. datasource, give 1 of these try.

if care checked items, it's little easier:

    '=== if care checked items (assuming used databound control)     each dr datarowview in cbxlstpancakes.checkeditems         dim currentpancake string = dr.item(0)   '--> todo:  correct column datasource         messagebox.show(currentpancake)     next 

if care both checked , unchecked items, should able access them way (should work either bound or unbound):

    '=== if care both checked , unchecked items     integer = 0 cbxlstpancakes.items.count - 1         if cbxlstpancakes.getitemchecked(i)             messagebox.show(cbxlstpancakes.getitemtext(cbxlstpancakes.items(i)))         else             'do if they're not checked         end if     next 

i'm not sure why checkedlistbox implemented little differently other controls (with .getxxxxx() methods, etc.). seems work me!


Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -