Hello
I am working with Telerik reports in Microsoft Visual Studio 2010. Using the code in a Telerik Reporting Tutorial, I am trying to use a C# code the designer code to populate and assign a data source. Following is my code:
namespace ClassLibrary3
{
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using System.Collections.Generic;
/// <summary>
/// Summary description for Report5.
/// </summary>
public partial class Report5 : Telerik.Reporting.Report
{
public Product ProductList() //The error here is' Not all code paths return a value'
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
List<Product> products = new List<Product>();
products.Add(new Product("bicycle"));
products.Add(new Product("helmet"));
products.Add(new Product("shoes"));
// Assign the generic list as the report DataSource
this.DataSource = products;
//
// TODO: Add any constructor code after InitializeComponent call
//
}
}
public class Product
{
private string _name;
public Product(string name)
{
_name = name;
}
public string Name
{
get { return _name; }
set { _name = value; }
}
}
}
Can someone please help me out? How do I get rid of this error message and preview the report?
Thanks,
I am working with Telerik reports in Microsoft Visual Studio 2010. Using the code in a Telerik Reporting Tutorial, I am trying to use a C# code the designer code to populate and assign a data source. Following is my code:
namespace ClassLibrary3
{
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using System.Collections.Generic;
/// <summary>
/// Summary description for Report5.
/// </summary>
public partial class Report5 : Telerik.Reporting.Report
{
public Product ProductList() //The error here is' Not all code paths return a value'
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
List<Product> products = new List<Product>();
products.Add(new Product("bicycle"));
products.Add(new Product("helmet"));
products.Add(new Product("shoes"));
// Assign the generic list as the report DataSource
this.DataSource = products;
//
// TODO: Add any constructor code after InitializeComponent call
//
}
}
public class Product
{
private string _name;
public Product(string name)
{
_name = name;
}
public string Name
{
get { return _name; }
set { _name = value; }
}
}
}
Can someone please help me out? How do I get rid of this error message and preview the report?
Thanks,