引用:FastReport.dll,FastReport.Bars.dll,FastReport.Editor.dll
设计好**.frx 文件
CS代码:
DataSet FDataSet = new DataSet();
DataTable table = new DataTable();
table.TableName = "Items";
FDataSet.Tables.Add(table);
table.Columns.Add("id", typeof(int));
table.Columns.Add("aaa", typeof(string));
table.Rows.Add(0,"ab");
table.Rows.Add(1,"abc");
FastReport.Report report1 = new FastReport.Report();
try
{
// load the existing report
report1.Load("***.frx");
// register the dataset
report1.RegisterData(FDataSet);
report1.GetDataSource("Items").Enabled = true;
// run the report
report1.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
// free resources used by report
report1.Dispose();
}