开发者

How to protect data on datagrid?

I have a datagrid contains sen开发者_如何学编程sitive data, which is, only allows user to read, nothing more (no modifying, no copying,...). How can I archive that? Datagrid has Readonly property, but I think it does not prevent user from copying data.

EDIT: I don't need to prevent user completely from copying data, just not allow them to copy easily mass data.


You COULD try to disable the copy functions. Perhaps you could take over Ctrl-C in a desktop application, and even Print-Screen - they could be 'disabled' for a desktop app. That doesn't ensure that the user doesn't have another software process to take their place.

There's really a lot of effort you could go to, but there are other 'copying' procedures that you wouldn't be able to stop:

  • manual copy (user viewing & typing in data into Notepad)
  • screen scraping tools
  • digital cameras

Are you using a DataGridView in WinForms? It sounds like you were looking for something on the grid to detect + prevent copying. You could try the Enabled property, set to false. That would at least disallow the mass selection by use of the top left button.

How to protect data on datagrid?


I agree with Campbell and all his commnets are absolutely true. However, if you set the Enabled Property to False, then you can not scroll to different parts of the Datagrid if it has many rows and columns.

So, one of the best ways to protect data in Datagrid view is:

1) Set Multiselect property to false. 2) Set ClipboardCopyMode to Disable.

If you need further security, you can change the Edit mode to EditProgramatically.

Best regards Ranjan Poudel Kathmandu, Nepal

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜