Hello

I am creating the windows application for reading, calculating and printing the data logged by my USB device in c#. I am basically a Microcontroller programmer but now learning C#.
I have already succeeded in collecting data from my system via USB (Code from Jan Axelson) and created graphs of data using ZedGraph. The basic setup is in place.

Now my requirement is that I have to prepare the data in a table form, make some calculations , make some results and show all these neatly in a form and print if needed. Even though i have different data sets, a single set can anyway accommodate in a A4 size sheet.
What should I look for ? Is it what we call report writer?
How should I proceed?

Thanks for reading
Roy Thomas

Hey Roy. I'm a little new to using the report controls shipped with VS, but they make life so much easier I think. Anyway, I want to see what recommendations others might make for you.

In the meantime, you could search the web for "CrystalReportViewer C# tutorial", or various other combinations to find a good tutorial on how to add this report viewer to your Form and how to design it to present your data the way you like. Hopefully you won't have any trouble incorporating your data into the design and building the visual presentation, but you could always ask about any problem with that too.

Thanks
I am reading a book named crystal reports for dummies. Just started!

I have to handle only a small data set. only 72 records. No different reports - only one report. I have no database, only a text file with these 72 records.
Will this huge report writer(crystal reports) be a overkill?
still may be useful in future projects, right?

Thanks

There is a control in Visual studio called Microsoft Report Viewer. I think that is a simple report generator compared to crystal reports. Let me see weather I can use it for my purpose.
Also in Projects->Add New Items->Reporting-> report and report wizard. Just cant figure out what are the difference between these reporting tools.

Thanks
Roy Thomas

Thanks
I am reading a book named crystal reports for dummies. Just started!

I have to handle only a small data set. only 72 records. No different reports - only one report. I have no database, only a text file with these 72 records.
Will this huge report writer(crystal reports) be a overkill?
still may be useful in future projects, right?

Thanks

I think Crystal Reports is the most popular/versatile for the $price$ too. As far as the overhead it produces, that would be easy enough for you to determine. Just build one project with and one without...

There is a control in Visual studio called Microsoft Report Viewer. I think that is a simple report generator compared to crystal reports. Let me see weather I can use it for my purpose.
Also in Projects->Add New Items->Reporting-> report and report wizard. Just cant figure out what are the difference between these reporting tools.

Thanks
Roy Thomas

I haven't done anything with the built in Report Viewer and don't know much about it, but I will know more if you post your findings here. ;)

Comments
Helpful

Thanks for the response
As I understood so far..
Visual studio has got a Microsoft report viewer control - built in. (Seems intended for simple reporting purposes)
That control can take a file called .rdlc file to create reports in the viewer. The control can use a rdlc file generator (Also built in).
But it needs a data sourse (Database or a object in my form. So I think I need to create a data object from my text file. (I am not sure.)
Here is what microsoft documentation says.-
Create the data sources you want to use. You can use data tables or business objects defined in datasets that are available in the project. For more information, see Creating Data Sources for a ReportViewer Report.

I am reading through. I think this control can do my job.
Please comment.

Thanks for reading
Roy Thomas

Thanks for the link crazyboy, but I am afraid I have no idea in VB so far. C and C# are the things I can understand. But will try.

Thank you
Roy Thomas

haha okay ...
i know VB also and i also want crystal report in my current project in C# but i m going to create it on after 2-3 days ..

so today i cant help u more regarding this

Hi,

Please follows these steps:

1. Create a sub-class of System.Data.DataSet

Example,

namespace test
{
    public class MyData : DataSet
    {
        public MyData()
        {
            DataTable dt = new DataTable("LogTable");
            // Add columns
            dt.Columns.Add("SrNo", typeof(int));
            dt.Columns.Add("Title", typeof(string));
           // add rows
            dt.Rows.Add(1, "A");
            dt.Rows.Add(2, "B");
            Tables.Add(dt);
        }
    }
}

2. Build your solution/project.
3. Add .rdlc item (Add New Item + Reporting + Report Wizard) into your project.
4. Choose "Object" as data source type and follows wizard step.

To view the report,

1. Drop MicrosoftReportViewer control onto the Form.
2. Choose report (.rdlc) file.
3. Add following code into Form_Load event,

// Create an object of datasource
           test.MyData data = new test.MyData();
          // Assign ref. of datasource
           BindingSource.DataSource = data;
           BindingSource.DataMember = "LogTable";

           this.reportViewer1.RefreshReport();
Comments
Very Very Very helpful!

Thank you adatapost. I am going to do it.

For the past 1 hour i was trying to figure out how to make a class and point it to report generator.

Now I got the starting point.

Thank you

Will be back

regards
Roy Thomas

I got it running in my form. Thanks a lot.
Now i have to populate with my data. I think I can do it. Then formatting to give looks.

Some theory..
In this example actually I think we are making a class for a dataset. The methods we call are actually creating a table with rows and columns.
Is this dataset and table are the same?
Thank you

Edited 7 Years Ago by RoyMicro: n/a

My table contains 3 columns and 72 rows. So if placed in sequence to bottom the report will look odd. I have to split this 72 rows into 18rows * 4 sections. One method I thought is increasing the rows to 12 and reducing columns to 18. Will it create any formatting issue?
Thank you

This article has been dead for over six months. Start a new discussion instead.