views:

39

answers:

2

I have an in house winform app for viewing, editing, and inserting member data. There are about 40 sepertate form pages that they use to manipulate different portions of the data.

My question is this; What is the best way of implementing a read only view for a form page?

My thoughts were to cycle through the controls setting Enabled = False or leave them be but not allow any data changes(no Save Button etc) unless it is "unlocked".

I am curious how others handle this with WinForm apps?

+1  A: 

I think that if a field is not meant to be edited, it shouldn't look like a field. Making it look like a field gives the user the visual queue that it should be editable. They may wonder why it's not. So instead of Enabled=False, why don't you make the readonly fields labels?

Update: An alternative if you have to keep them Text fields is to style them to look like labels. This would mean making their background color gray, removing the border and removing the tabstop. You could create a DisableField function to do this.

Keltex
Not sure this is feasible for our setup. I'd have to swap out `labels` for `textboxes` whenever they wanted to edit the information.
Refracted Paladin
Yes, it's a better user experience. Otherwise, users tend to ask "how can I enable that field ?"...
Seb
so you would have multiple forms based on the current user. If they only currently have Read-Only then shown them `frmMemberReadOnly`. If they currently have Full permissions then show them an entirely different form(`frmMemberFull`) with editable controls....
Refracted Paladin
A: 

It might be better to say it this way, if the fields on the form are read-only, then replace them with labels which are not editable. This will be more suited for textboxes, checkboxes, as for combo-boxes and list-boxes, perhaps, you will have to give them a label also, by showing the selection used in both cases as labels - what do you think?

In fact, here are some links that will enable you to retain the combo-box/listboxes if you wish to avoid making the selections as labels...

  • An article on implementing a readonly combo-box is on CodeProject
  • The only gotcha is the combo-box will not look exactly polished if readonly, this article on CodeProject shows how to make it more polished.
  • A readonly combobox (VB.NET) using the IExtendedProvider here on CodeProject
  • A Listbox combined with a checkbox used as a readonly listbox here on CodeProject
  • How to disable the checkbox but not the scrollbar here on Social.MSDN.Microsoft.com
  • An article on listbox with disabled items here on CodeProject
tommieb75