C# Windows Form :Strict some fields according to the logged in user

I am working on Windows Form (C#) visual studio and .net 3.5, my program is a database-based, with multi-user, database store info about devices and contract, what I need is a way to restrict specific fields to (Modify,ReadOnly,Hidden) receptively to the logged-in user privileges, I don't want to use windows users, I want my users (from a database)to make them separate from OS, at least for now, so for example I have a form with 21 fields, five of them must be hidden when employee with no financial privileges has logged-in, but when his supervisor is the user, then he can see the financial field but not modify it's value, and when the administrator is logged-in he can do what every he wants to do

I hope I make it clear enough to help me out,


If you've read the user and their privileges from your database, it's just a matter of setting the Visible property of any control you don't want shown.

this.FinanceField1.Visible = !IsEmployee();
this.FinanceField2.Visible = !IsEmployee();

this.FinanceField3.Enabled = !IsSupervisor();

Or something similar to this.

Implement a permissions table in your database that you read when the use logs in. Then set your form state based upon the passed permission.

Need Your Help

MySQL InnoDB database restore using .frm files and ibdata files

mysql xampp innodb recover

Hi mistakenly I have deleted my MySQL database from Windos XP based PC (this database was used to host a Wiki service using Xampp package). Now I am trying to restore the data so that I can atleast

How to use Spring Autowired in a custom cxf interceptor?

web-services spring dependency-injection cxf

i seem to run into a small issue when using @Autowired into a custom cxf interceptor.