【发布时间】:2013-09-15 12:03:03
【问题描述】:
我有一个类接收所有水晶报表req来打开报表的形式(一个开关和很多案例)。
而且每次这段代码我都需要复制粘贴
if (sender.GetType() == typeof(CheckBox))
{
foreach (CheckBox elemento in flowLayoutPanel1.Controls.OfType<CheckBox>())
{
if (elemento.Checked)
{
foreach (string elemento2 in ListaTodos)
{
string Name = elemento.Tag.ToString();
if (Name.Substring(Name.Length - 1, 1) == elemento2.Substring(elemento2.Length - 1, 1))
{
crParceiro.ReportDefinition.ReportObjects[Name].ObjectFormat.EnableSuppress = false;
crParceiro.ReportDefinition.ReportObjects[elemento2].ObjectFormat.EnableSuppress = false;
}
}
}
else
{
foreach (string elemento2 in ListaTodos)
{
string Name = elemento.Tag.ToString();
if (Name.Substring(Name.Length - 1, 1) == elemento2.Substring(elemento2.Length - 1, 1))
{
crParceiro.ReportDefinition.ReportObjects[Name].ObjectFormat.EnableSuppress = true;
crParceiro.ReportDefinition.ReportObjects[elemento2].ObjectFormat.EnableSuppress = true;
}
}
}
}
}
问题:我创建了一个函数并试图将这部分代码粘贴到那里...并且我通过了 crParceiro.ReportDefinition 和 crParceiro。 ReportDefinition.ReportsObject 但它没有设置属性,我无法设置它并返回 REF 我们的 OUT...
我试图返回值和 Linq 表达式(它说...“对象没有设置属性”)没有成功 **Linq Exp及返回值参考:**Link here
这个问题的一个很好的例子是:
ReportDefinition teste = new ReportDefinition();
teste.ReportObjects = null;
//Error: Property or idexer ...cannot be assigned to -- its read only.
我能做什么?我很迷茫..
【问题讨论】:
标签: c# linq crystal-reports lambda return