Daudi

hi all

I Have two list view in a form.

List view 1 contains users while listview 2 contains roles assigned to each selected user. My problem is that i want when i select a user (say Item(0)), List view 2 to display all the roles assigned to him with a check and those not assigned without a check.

Am using a dataset which contains all the roles available and the users assigned to those roles. Am able to load the list view with all the available roles but am Unable to check those roles assigned to specific users.

my question is how to check roles that matches the roles of the specific user in the dataset



Re: Visual Basic IDE List View problem

Spidermans_DarkSide

Hi,

I would suggest you create an array to hold string values such that>>

'--------------------------------------------------START OF CODE-------------------------------------------

Dim userRoles() As String

userRoles(0)="0101000011111010"       '   String length to depend on the total number of roles.

'   So if the 1st digit is a zero then the role is unchecked  

'   and the 2nd role checked ( in this example )....and so on....

'  Repeat the above for each user. You can soon then

'  change the user role string for any user if His / Her roles 'change.

'  You might want to implement this another way say.>>

Dim userRoles(Total_Number_Of_Users -1, Total_Number_Of Roles -1) As Boolean

'  then you could do.>>

userRoles(3,5)=True '  If user 4 has role number 6 checked. Including the zero indexes.

' IMPORTANT TO NOTE THAT THE INDICES IN ARRAYS START FROM ZERO

'HENCE THE REASON FOR MY LAST DIM STATEMENT CONTAINING A MINUS ONE FOR EACH INDEX.

'   However you may want to ignore this fact and start each from number 1 so the line would then be.>>

Dim userRoles(Total_Number_Of_Users, Total_Number_Of Roles ) As Boolean

'--------------------------------------------------END OF CODE------------------------------------------

 

Regards,

S_DS.