By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,616 Members | 2,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,616 IT Pros & Developers. It's quick & easy.

No data appearing in my report

P: n/a
I'm putting together a REALLY simple report for my WinForms app.

I use an object data source. Here's the class:
public class ProjectEnergyUsageReportValues
private double defaultUsage;
public double DefaultUsage
get { return defaultUsage; }
set { defaultUsage = value; }
private double oldUsage;
public double OldUsage
get { return oldUsage; }
set { oldUsage = value; }
private double newUsage;
public double NewUsage
get { return newUsage; }
set { newUsage = value; }
No brainer. I have an embedded RDLC file. When I created the RDLC file, I
added the class to my data sources window, and dragged the properties
(DefaultUsage, OldUsage, NewUsage) to the "data fields" section. I see the
three of them listed there.

When I added the ReportViewer control to my form, I used the smart tag to
associate it with the RDLC file I created.

Here's what I'm doing in my report form constructor:
reportViewer1.ProcessingMode = ProcessingMode.Local;

ProjectEnergyUsageReportValues reportValues = new
reportValues.DefaultUsage = 5.0;
reportValues.OldUsage = 6.0;
reportValues.NewUsage = 7.0;

BindingSource bindingSource = new BindingSource();
bindingSource.DataMember = "ReportValues";
bindingSource.DataSource = reportValues;

ReportDataSource("ProjectedEnergyUsage_ReportValue s", bindingSource));

And finally, in the form load event:

When I run the app and open the form, I see the report layout fine, but
there's no data.

Any idea why?

Apr 25 '07 #1
Share this Question
Share on Google+
2 Replies

P: n/a

I guess I should have mentioned that I'm creating a simply report using the
new WinForms ReportViewer control.

Anyways, I'd really like some help with this issue.... Anyone?!
Apr 26 '07 #2

P: n/a

As it turns out, the problem was my data source. When you're using an
object data source, you must specify a collection (implements IEnumerable) of
objects. I was just passing in one object. When you think about it, it
makes sense.

Anyway, yay, it works now!
Apr 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.