在第二次基本运行后,我在主题中得到错误。它发生在最后一行,student_count = Convert ...
当它第一次运行时,它会显示正确的列和列名称格式以及报告的标题等。我的意思是当我在脚本选项卡下输入此代码,然后单击预览选项卡时,它显示列名称,报告标题等。但是,当我单击脚本选项卡或设计器选项卡上然后单击返回预览选项卡时,它会向我抛出该错误。因此,我说第二次运行的东西,因为它似乎是在第一次之后这样做。
我现在在MS VS 2008中运行了一个调试器,最后一行得到newline in constant
:
student_count = Convert.ToDecimal(textBox("Detail","txtR0_SisNumber4″).Name);
public Section section(string sectionName)
{
return (Section) rpt.Sections[sectionName];
}
public TextBox textBox(string sectionName, string controlName)
{
return (TextBox) section(sectionName).Controls[controlName];
}
public Picture picture(string sectionName, string controlName)
{
return (Picture) section(sectionName).Controls[controlName];
}
public string textBoxTxt(string section, string name)
{
if( textBox(section, name)!=null){
return textBox(section, name).Text;
}
return "";
}
public void PageHeader_BeforePrint()
{
try{
picture("PageHeader","imgOrgLogo").Image = System.Drawing.Image.FromFile(textBoxTxt("PageHeader", "dataOrgLogo"));
}
catch { }
}
public void PageFooter_BeforePrint()
{
textBox("PageFooter","txtPageIndicator").Text = "Page "
+ textBoxTxt("PageFooter","txtPageNum")
+ " of "
+ textBoxTxt("PageFooter","txtPageTotal");
}
public void Detail_BeforePrint()
{
decimal student_count, student_total;
string percentage_string;
student_count = Convert.ToDecimal(textBox("Detail","txtR0_SisNumber4″).Name);
}
答案 0 :(得分:0)
Convert.ToDecimal(textBox("Detail","txtR0_SisNumber4″).Name);
等于
Convert.ToDecimal("txtR0_SisNumber4″);
这可能会导致错误。我认为这一行应该看起来像
Convert.ToDecimal(textBox("Detail","txtR0_SisNumber4″).Value);