Hello Guys,
I just started to play with the Barcode object and I love that it can utilize soo many barcode types but I was trying to find a way to use it in my winforms directly.
For example, I’d like to be able to pass in the barcode type, value, and have it give me a binary stream so I can save it elsewhere or show it in a picture box.
Is there any way to do this *without* creating a report, using a data source and using the report viewer?
I tried just about everything you can think of after following this example http://www.telerik.com/help/reporting/programmaticexportingareport.html but it seems to be a bit much just to export/view a barcode.
C# .NET 2008,
After we try we got the problems below;
The current solution
we are manual create the connection string by hardcode "see Code #1" it's give us the preview on design time
below are the current source code we are using for the moment
| public partial class Report1 : Telerik.Reporting.Report |
| { |
| public Report1() |
| { |
| /// <summary> |
| /// Required for telerik Reporting designer support |
| /// </summary> |
| InitializeComponent(); |
| sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); |
| sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); |
| sqlConnection1 = new System.Data.SqlClient.SqlConnection(); |
| sqlConnection1.ConnectionString = |
| "Data Source=Develop_telerik;Initial Catalog=insurance;Persist Security Info=True;User ID=sa;Password=rYnI@6%33$3kdnOOk"; |
| sqlSelectCommand1.CommandText = "SELECT * FROM TelerikReport"; |
| sqlSelectCommand1.Connection = sqlConnection1; |
| sqlDataAdapter1.SelectCommand = sqlSelectCommand1; |
| this.DataSource = sqlDataAdapter1; |
| } |
| } |
| } |
[Code #1]
above the code inside the report
It's gave us the preview in design time
| System.Data.SqlClient.SqlCommand sqlSelectCommand1; |
| System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; |
| System.Data.SqlClient.SqlConnection sqlConnection1; |
| Report1 _report1 = new Report1(); |
| sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); |
| sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); |
| sqlConnection1 = new System.Data.SqlClient.SqlConnection(); |
| sqlConnection1.ConnectionString = ConfigurationManager.ConnectionStrings["TelerikConnectionString"].ToString(); |
| sqlSelectCommand1.CommandText = "SELECT * FROM TelerikReport"; |
| sqlSelectCommand1.Connection = sqlConnection1; |
| sqlDataAdapter1.SelectCommand = sqlSelectCommand1; |
| _report1.DataSource = sqlDataAdapter1; |
| ReportViewer1.Report = new Report1(); |
[Code #2]
above are the code in the ReportView page
Any ideas, to improve the development time or anyone has the sample project like this.
Kind Regards,
Kwan