Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Joining two DataTables to a CheckListBox control...

Joining two DataTables to a CheckListBox control...

Scheduled Pinned Locked Moved C#
wpfwcfcomtutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andrew Connell
    wrote on last edited by
    #1

    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. Currently, I am binding the tblKeyword table to the control.. then stepping through everything in the list, checking to see if it's in the tblProjectKeyword list, and checking those that are found. When the checked state changes, I manually add/delete items to the tblProjectKeyword Datatable. Thanks for your input in advance! AC Andrew Connell IM on MSN andrew@aconnell.com

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups