Link to home
Start Free TrialLog in
Avatar of mlagrange
mlagrangeFlag for United States of America

asked on

Need example of dual list box, with database code

Hello - Thanks, MacEx for your code snip for dual list boxes. Could you please elaborate on that, for use against a couple of database tables?

I'm trying to work up a page that allows a primary system user to specify the allowable divisions a regular staff-level user can access in a corporate financial system.

Given a lookup table like:

DivID / DivDesc
1  Accounting
2  Advertising
3  Engineering
4  HR
5  IT
etc...

...and a user control table like:
UserID / DivID
User01  1
User01  2
User02  2
User03  1
User03  4
User03  5
etc...

...I'd like to display the DivID's (that the user isn't already set up for) on the left-hand list box, and the DivID's they ARE set up for on the right-hand list box

I know what the queries (or views, or SP's) that pull the rowsource for the two list boxes needs to look like (I've done this before in MS Access/VBA). I just don't know how to code the list box events in VB.NET to pull the recordset's, and update them after an update.

And is that even the best way? Database updates after every listbox update, or pull the 2 rst's into arrays, do all the back & forth locally, until they click "Save", and then update the user control table? (this will be an intranet application)

Thanks; I hope this isn't over-reaching

Mark
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial