Look at your constructors:
public fact_row()
{
InitializeComponent();
}
public fact_row(string rowid, string account_no1, string account_no2, string operation, string type,
string debtor, string creditor)
{
this._row_id = rowid;
this._account_no1 = account_no1;
this._account_no2 = account_no2;
this._operation = operation;
this._type = type;
this._debtor = debtor;
this._creditor = creditor;
}
Only one of them calls InitializeComponent - which is the method which creates all the controls your user control displays. If you don;t call it, then your text boxes, labels, and panels never get created, so the references are null.
Add the call your your parameterized constructor, and the problem will go away!
public fact_row(string rowid, string account_no1, string account_no2, string operation, string type,
string debtor, string creditor)
{
InitializeComponent();
this._row_id = rowid;
this._account_no1 = account_no1;
this._account_no2 = account_no2;
this._operation = operation;
this._type = type;
this._debtor = debtor;
this._creditor = creditor;
}
BTW: the standard is that private backing fields start with underline, public properties shoudl
start with an Uppercase letter - and that you should use camelCase instead of underlines in variable, property, method, and control names:
public string RowId
{
get { return lblRowId.Text; }
set { lblRowId.Text = value; }
}
[edit]Missed an underline :doh:[/edit]