Mayank Jani

Mayank Jani

  • NA
  • 477
  • 72.8k

How to get CheckedListBox values from DataBase?

Jan 11 2018 1:24 PM
Dear All,
Greetings of the day..
 
Please take a look at my problem. I want to get the CheckedListBox items Checked according to the database when I select an option from a DataGridView.
 
In a WinForm, I have a DataGridView contains User names (XYZ, ABC etc.) and a CheckedListBox contains different rights (Billing, Purchase, Stores, Edit, Delete etc.) to the user. a user (e.g. XYZ) rights saved (e.g. Purchase, Billing etc.) to MS Access database in a table...
UserName   UserRights
XYZ              Billing
XYZ              Purchase
XYZ              EditBills
 
Now, i want to see all the rights given to XYZ in the CheckedListBox when I select name XYZ from the DataGridView.
 
I got almost result but there is something missing that compares the db to CheckedListBox.
Please see the screen shots attached to get it more clearly. in this code (The Code.jpg) I only get first few items checked regardless, the actual rights.
 
Thank You.
 
Mayank Jani

Attachment: TheCode.zip

Answers (7)