Click to See Complete Forum and Search --> : Checking items in a CheckedListBox
anis_b
Mar 4th, 2003, 07:27 AM
I have populated a CheckedListBox with values from DB this way...
MyMenu.DataSource = dv
MyMenu.DisplayMember = "Menu_Name"
this works fine... it gets populated.
but i want few items to be checked, the value of which is stored in another BIT field of the same table.
how do it do that.
do i have to loop thru all the items ????
Pirate
Mar 4th, 2003, 10:12 AM
Is this what you mean which will select specific items by code
CheckedListBox1.SetItemChecked(1, True)
CheckedListBox1.SetItemChecked(2, True)
:rolleyes:
anis_b
Mar 4th, 2003, 10:41 AM
My situation is that I have two tables: tblKeyword and tblProjectKeyword.
tblKeyword contains a list of available keywords (intKeywordID, txtKeyword).
tblProjectKeyword (intProjectID, intKeywordID).
tblProjectKeyword.intKeywordID is a FK to tblKeyword.intKeywordID.
tblProjectKeyword.intProjectID is also a FK to another table. So the
tblProjectKeyword table is a Many-Many relationship... a join table.
What I'd like to do is bind the contents of tblKeyword to a CheckListBox
control but have all the matching records in tblProjectKeyword appear
checked for a specific project. My keywords work similar to the Categories
window in Outlook items... the user will be able to check/uncheck and add
more keywords to the list.... So, the CheckedListBox would contain ALL
keywords, and have only those in the tblProjectKeyword checked. Additions
to the list would be added to the tblKeyword table and checked items would
be added to the tblProjectKeyword table.
Currently I'm implementing this manually (creating all the items... when one
is checked, I add a record to the table, etc, etc). I was wondering if I
could use databinding with this complex example. I know you can bind a
table to it, but I didn't know if I could bind two tables with some specific
conditions.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.