Winforms Xtrareport数据绑定格式字符串“0”;对象引用未设置为对象的实例;devexpress 12.2.7

Winforms Xtrareport数据绑定格式字符串“0”;对象引用未设置为对象的实例;devexpress 12.2.7,winforms,devexpress,xtrareport,Winforms,Devexpress,Xtrareport,我想在Xtrareport中显示千位分隔符,这段代码在DevXpress版本14中工作得很好,但在版本12.2.7中,它会出错: An unhandled exception of type 'System.NullReferenceException' occurred in Kho3.exe Additional information: Object reference not set to an instance of an object. 我的代码: private void xxS

我想在Xtrareport中显示千位分隔符,这段代码在DevXpress版本14中工作得很好,但在版本12.2.7中,它会出错:

An unhandled exception of type 'System.NullReferenceException' occurred in Kho3.exe
Additional information: Object reference not set to an instance of an object.
我的代码:

private void xxSL_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
            {
               xxSL.DataBindings["Text"].FormatString = "{0:N0}";
            }

如何修复它?

DevExpress 12.2.x XRLable只是没有数据绑定[“文本”]。所以我不能使用它,因为任何像我这样遇到这个问题的人

你调试过你的代码吗?xxSL是否为空?还是xxSL.数据绑定?或xxSL.数据绑定[“文本”]?如果在这些代码行中发生异常,我认为没有其他可能性,而不是其中一行是空的。是的,我调试过,xxSL.DataBindings[“Text”]为空,xxSL和xxSL.DataBindings不为空