开发者

NullReferenceException occurs when viewing crystal report

I have a context menu strip for each dataGridView row, when I click on print "P.O report" it opens a crystal report, here is the code:

private void printPOToolStripMenuItem_Click(object sender, EventArgs e)
{
    string id = dataGridView1.CurrentRow.Cells[0].Value.ToString();
    POreport por = new POreport(Convert.ToInt32(id));
    por.Show();
}

And here is the constructor for the POreport class:

public POreport(int poId)
{
    this.crystalReportViewer1.SelectionFormula = 开发者_JAVA百科"{poView.poId}="+poId;
}

But a NullReferenceException occurs each time:

Object reference not set to an instance of an object.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜