Problem with multiple selection.

jue

Member
Joined
Apr 1, 2005
Messages
11
Programming Experience
Beginner
hi..
i've problem here.

i have check box, chkcategory. this check box user can select more than 1. and this chkcategory dynamic. user can add on. i want to know how the database look like. how to insert and select into database? is it have to store separate database.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,328
Location
Sydney, Australia
Programming Experience
10+
If I have understood you correctly, I think you should be using a CheckedListBox, which allows items to be added and removed like a regular ListBox, but also adds a check box next to each item. You would then have a database table with a Category column and a Checked column, or some name more suitable to what it actually represents. The Category column would contain the text of each item and the Checked column would contain the CheckState. Note that if you want to be able to change the name of a category and still have it represent the same category, you will need to have another ID column as primary key and not use the name.
 
Last edited:

jue

Member
Joined
Apr 1, 2005
Messages
11
Programming Experience
Beginner
HI..
Tq reply my message...
i already use check box list...
my problem is in database ..i don't know how to create check in database.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,328
Location
Sydney, Australia
Programming Experience
10+
As I said in my previous post, your database table will contain a column for the Category, which will have some type suitable for text, and a column for the Checked value, which will be of a type suitable for a boolean value. I use mostly MS Access, which has a Yes/No type for columns, while most real databases probably have a bool or boolean type. You can use the CheckedItems property of the CheckedListBox to assign True or False to the field corresponding to the Checked column in each DataRow.
 
Top Bottom