Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of objects? 1

Status
Not open for further replies.

keen2know

Programmer
Sep 27, 2002
9
GB
Hi,

I have a security requirement to maintain 5 levels of user access to buttons on my forms. I am planning to store the button names (by form) in a database table, and call a class on entry to each form so that the respective buttons are enabled or visible.

Is it possible to loop through my dataset and set the button properties when I only have the buttons "NAME" saved in the database? If not, can I store a reference to the object that I can use instead?

Thanks

JJ
 
So you want an array of controls? I'm not sure how you could do this without hard coding some of it. I would just store the login info and the access level in the db, then make use a switch statement for the buttons.

Like

Case 1:
cmd1.enabled = true;
cmd2.enabled = false;
etc.

Case 2:
cmd1.enabled = true;
cmd2.enabled = true;
etc.

etc.
 
Begger that.....

Create custom controls inheriting from the base....

Add a UserAccess property....

Set the property according to the group.....

Then set up some looping to loop the controls and compare the UserAccess property to the access level.....

Craig
 
Thanks Riverguy and Craig,

I am trying to create a generic class which will work with all of my forms without having to hard code any button names (except in the database - data driven) As long as the database has an entry for the form and the button, it will apply the permissions. The class will query the database on entry to a form and return only rows (one per button name) for the respective form.

I want to build a collection of buttons on the respective form and apply the attributes by referencing the collection. I am now trying to research how to add every button on a given form into a collection.

Any ideas appreciated.

cheers

JJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top