1

我在 Visual Studio 中使用 Telerik Reporting 2010。我试图重命名饼图中图例的标签。我认为我的问题出在代码中,但我的知识有限,所以我看不出有什么问题。谁能帮我找出问题所在?我得到的错误在底部。

namespace Reports
{
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;


/// <summary>
/// Summary description for DeliveryStatus___Client.
/// </summary>
public partial class DeliveryStatus___Client : Telerik.Reporting.Report
{
    public DeliveryStatus___Client()
    {
        //
        // Required for telerik Reporting designer support
        //
        InitializeComponent();}


        //
        // TODO: Add any constructor code after InitializeComponent call
        //
    private void chart1_ItemDataBinding(object sender, EventArgs e)
{
        var procChart = ((Telerik.Reporting.Processing.Chart)sender);


        Telerik.Reporting.Charting.LabelItem labelItem1 = new       Telerik.Reporting.Charting.LabelItem();
        Telerik.Reporting.Charting.LabelItem labelItem2 = new   Telerik.Reporting.Charting.LabelItem();

            labelItem1.Marker.Visible = true;
            labelItem1.Name = "LegendItem1";
            labelItem1.TextBlock.Text = procChart.Report.Parameters["Due Beyond"].Value.ToString;
            labelItem2.Marker.Visible = true;
            labelItem2.Name = "LegendItem2";
            labelItem2.TextBlock.Text = procChart.Report.Parameters["Due Monday"].Value.ToString;
            this.chart1.Legend.Items.AddRange(new Telerik.Reporting.Charting.LabelItem[] {
            labelItem1,
            labelItem2});
        this.chart1.Legend.Items.AddRange(new Telerik.Reporting.Charting.LabelItem[] {labelItem1,});
}



     Error  2   Cannot implicitly convert type 'object' to 'string'. An explicit      conversion exists (are you missing a cast?)   C:\Users\wondergoat77\Documents\VS -     Projects\Reports\Reports\DeliveryStatus - Client.cs    34  45  
     Error  3   Type or namespace definition, or end-of-file expected       C:\Users\wondergoat77\Documents\VS - Projects\\Reports\DeliveryStatus - Client.cs   52      1   
      Error 4   Cannot convert method group 'ToString' to non-delegate type     'string'. Did you intend to invoke the method?  C:\Users\wondergoat77\Documents\VS -     Projects\Reports\Reports\DeliveryStatus - Client.cs    34  45  
      Error 5   Cannot convert method group 'ToString' to non-delegate type     'string'. Did you intend to invoke the method?  C:\Users\wondergoat77\Documents\VS -     Projects\Reports\Reports\DeliveryStatus - Client.cs    37  45  










     }
         }
     }
4

1 回答 1

1

您忘记了 ToString 是一种方法,因此您必须调用它(添加括号):

labelItem1.TextBlock.Text = procChart.Report.Parameters["Due Beyond"].Value.ToString();//here
labelItem2.TextBlock.Text = procChart.Report.Parameters["DueMonday"].Value.ToString();//here
于 2012-04-18T06:16:48.017 回答