4

オブジェクトのリストから Microsoft Report でレポートを作成する方法に関するコード スニペット、チュートリアル リンク、または情報を提供できる人はいますか?

次の Dog クラスがあります。

namespace MyNS
{
   public class Dog
   {
      public int Legs { get; set; }
      public string Name { get; set; }
      public string Breed { get; set; }
   }
}

次に、ウィンドウ フォームに、次のようにMyNS.Dogオブジェクトのリストから入力したい ReportViewerオブジェクトがあります。

List<MyNS.Dog> MyDogs = new List<MyNS.Dog>();
// populate array here
// and use it as datasource for ReportViewer

何か案は?

ありがとう!

4

2 に答える 2

2

ローカル レポートの場合、次のようにデータ ソースを指定できます。

var reportViewer = New ReportViewer();
var reportDataSource = New ReportDataSource("MyNS_Dog", MyDogs);
reportViewer.LocalReport.DataSources.Add(reportDataSource);
于 2009-05-04T16:42:31.020 に答える