locked
Simple report created from code Visual Studio 2013 RRS feed

  • Question

  • Hi everybody

    Can you please give me some hints on how to create a really simple Report with Visual Studio 2013, visual basic, completely code generated?

    I mean, I have an application (windows form application) really simple, with data from input, it calculate some math calculations I need, then I have to generate a report with the results. The report is made of text, drawings, formulas. I need to do it all by code, at run-time, not before (I don't know how many texts or which drawings I have to do untill runtime). So my data are simply the variables I have and I will generate what I need.

    In the end, I need a report with no connection to db but where I simply write texts and print lines/arcs... but with all the functionality of page settings and printing (and maybe exporting...).

    I've found any kind of information about any kind of complex report full of thins I don't need (crystal reports,ReportViewer...), is there anything that simple? An example or some documentation I can study? Maybe that is too simple for you but I am a newby, please forgive me :)

    Thanks in advance

    Friday, October 24, 2014 8:57 AM

Answers

  • Thank you all for your quick reply.

    I will post in the forum you suggest, pvdg42, thanks.

    Deric, printDocument was the first one I tried, maybe I was not so wrong, in the end :) I was just afraid I used a method (it will be a long work) and then I discover there is another method that is much better. In your opinion, is System.Drawing in some way simpler/faster or more flexible?

    Jack, I can't tell how I want to create the report, because that is the very question :). Export to what is common, pdf, rtf... I will have a deep look in what you linked. Thank you.

    Hi quasar.eis,

    Since you would post this issue to the better forum, I will close this case in our forum.

    In addition, it seems that the best way of implementing a custom print operation in .NET is to create your own class that holds a private variable that is of type PrintDocument.

    Reference:

    http://www.codeproject.com/Articles/27404/An-absolute-beginner-s-guide-to-printing-in-NET

    Hope it could help.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, October 27, 2014 9:38 AM
  • Thank you all for your quick reply.

    I will post in the forum you suggest, pvdg42, thanks.

    Deric, printDocument was the first one I tried, maybe I was not so wrong, in the end :) I was just afraid I used a method (it will be a long work) and then I discover there is another method that is much better. In your opinion, is System.Drawing in some way simpler/faster or more flexible?

    Jack, I can't tell how I want to create the report, because that is the very question :). Export to what is common, pdf, rtf... I will have a deep look in what you linked. Thank you.

    Sure it's not simpler/faster but you wrote that you are avoiding all existing options that are simple such as "crystal reports,ReportViewer..."
    Monday, October 27, 2014 11:16 AM

All replies

  • As you are asking about generating a report in VB code, I suggest you ask the helpful VB experts here:

    https://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads

    Friday, October 24, 2014 2:12 PM
  • If you do not need to use nay report tool you should use printDocument to print/export your form to PDF, etc.

    Or, you can use System.Drawing to draw the report by yourself.

    Friday, October 24, 2014 2:17 PM
  • Thanks for pvdg42 and Deric’s help.

    Hi quasar.eis,

    Thank you for posting in the MSDN forum.

    I think Deric’s suggestion would be helpful for you.

    But if you really want to achieve it in VB development, like pvdg42’s suggestion, you could post this issue to the VB forum, but you’d better share more detailed information in your new thread, for example, how did you want to create a report? Which format file you want to report or others?

    If you want to achieve it with report control, I suggest you post this issue to the Report control forum:

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=vsreportcontrols

    Some documents which are related to reports, maybe they could help you.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/b7e5f487-6d71-4bd6-967f-168cfd028287/printdocument-as-pdf

    http://msdn.microsoft.com/en-us/library/bb882691.aspx

    http://msdn.microsoft.com/en-us/library/ms252091.aspx

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, October 27, 2014 7:27 AM
  • Thank you all for your quick reply.

    I will post in the forum you suggest, pvdg42, thanks.

    Deric, printDocument was the first one I tried, maybe I was not so wrong, in the end :) I was just afraid I used a method (it will be a long work) and then I discover there is another method that is much better. In your opinion, is System.Drawing in some way simpler/faster or more flexible?

    Jack, I can't tell how I want to create the report, because that is the very question :). Export to what is common, pdf, rtf... I will have a deep look in what you linked. Thank you.

    Monday, October 27, 2014 9:05 AM
  • Thank you all for your quick reply.

    I will post in the forum you suggest, pvdg42, thanks.

    Deric, printDocument was the first one I tried, maybe I was not so wrong, in the end :) I was just afraid I used a method (it will be a long work) and then I discover there is another method that is much better. In your opinion, is System.Drawing in some way simpler/faster or more flexible?

    Jack, I can't tell how I want to create the report, because that is the very question :). Export to what is common, pdf, rtf... I will have a deep look in what you linked. Thank you.

    Hi quasar.eis,

    Since you would post this issue to the better forum, I will close this case in our forum.

    In addition, it seems that the best way of implementing a custom print operation in .NET is to create your own class that holds a private variable that is of type PrintDocument.

    Reference:

    http://www.codeproject.com/Articles/27404/An-absolute-beginner-s-guide-to-printing-in-NET

    Hope it could help.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, October 27, 2014 9:38 AM
  • Thank you all for your quick reply.

    I will post in the forum you suggest, pvdg42, thanks.

    Deric, printDocument was the first one I tried, maybe I was not so wrong, in the end :) I was just afraid I used a method (it will be a long work) and then I discover there is another method that is much better. In your opinion, is System.Drawing in some way simpler/faster or more flexible?

    Jack, I can't tell how I want to create the report, because that is the very question :). Export to what is common, pdf, rtf... I will have a deep look in what you linked. Thank you.

    Sure it's not simpler/faster but you wrote that you are avoiding all existing options that are simple such as "crystal reports,ReportViewer..."
    Monday, October 27, 2014 11:16 AM