Results 1 to 3 of 3

Thread: Checking items in a CheckedListBox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    110

    Checking items in a CheckedListBox

    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 ????
    Anis Bombaywala

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Is this what you mean which will select specific items by code

    VB Code:
    1. CheckedListBox1.SetItemChecked(1, True)
    2. CheckedListBox1.SetItemChecked(2, True)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    110

    no.. let me explain you in detail..

    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.
    Anis Bombaywala

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width