I am getting a strange error that I can't nail ...
Error: Object reference not set to an intance of an object. Module : SetControlPermissions
This occurs in a plugin on the CreditorPurchases form. I have (manually) added and populated some extra grid columns.
Initially I was getting this error when opening the form. I managed to solve this by now adding the columns to the grid in the _creditorPurchases.Load event handler, which all works perfectly.
All functionality works fine on and after opening the form, until I navigate to another batch record ... then I get Error: Object reference not set to an intance of an object. Module : SetControlPermissions, which seems to also kill any further plugin code from running.
The code that adds the column is akin to the following:
- Code: Select all
_creditorPurchases = (CreditorPurchases)JiwaForm;
_sheet = _creditorPurchases.grdLines.ActiveSheet;
[SNIP]
var col = _sheet.ColumnCount;
_colFilename = col;
_sheet.ColumnCount += 1;
_sheet.ColumnHeader.Cells[1, _colFilename].Text = "Attachment";
_sheet.Columns[_colFilename].Width = 300;
_sheet.Columns[_colFilename].CellType = new TextCellType() { NullDisplay = "Drop file(s) here, or select", ReadOnly = true };
Wrapping this in a Try-Catch doesn't help, and in fact after adding debug logging to EVERY method in the plugin I discovered that none of them fire, on record change, prior to the error displaying (or at all).
My guess is that I need to register something so that SetControlPermissions knows about the new column?
Cheers,
Neil.


