The error message indicates that either
txt
or
txt_egample
is
NULL
.
I guess it is
txt
when there is no component named "Text5" here:
txt = (StiText)myreport.GetComponentByName("Text5")
You are also assigning to
txt
after you have allocated an
StiText
instance here so that this instance is never used:
StiText txt = new StiText();
I don't know StimulSoft but it seems you can just use
StiText txt = (StiText)myreport.GetComponentByName("Text5")
and omit the allocation. But you should still check if
txt
is valid (not empty).
[EDIT]
Sorry, I forget that you want to set the text.
There is a
SetText
function:
StiText txt = (StiText)myreport.GetComponentByName("Text5");
txt.SetText(txt_egample.Text);
[/EDIT]