Question Checkbox question

Silvia

New member
Joined
Jun 12, 2011
Messages
1
Programming Experience
Beginner
Hi everybody,

I am currently using microsoft access 2007 and vb.net 2008. The problem senario is
this: I have a database-table that contains two columns, items, and the price of each item. I tried to drag this table to the form as a checkbox tool, but only one checkbox1 was diplayed. The table consists of four rows. My requirement is when I drag the checkbox I want to see the all items in the first column, i.e. four checkboxes that hold the same name as in the table in the database, and when I check one or more items to be able to use, in somehow, the price(s) to make some kind of calculations. How do I go about doing this, as I
am new to VB? Thanks in advanced.

Silvia
 
Controls are created based on schema only, not data. How could four CheckBoxes be created when the system has no idea of whether there will be four records or more or less when you actually run the app? If you specifically want four CheckBoxes then that's something that you'd have to do yourself, then write code to populate the controls appropriately.

I think that a more logical option would be to use a CheckedListBox. You simply bind your DataTable to the control and you get an item for each record with a check box for each. Each time an item is checked or unchecked, you use the CheckedItems collection to get the items that are checked and use them accordingly.
 
Back
Top