Click here to Skip to main content
15,904,346 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi All..
please send a simple code for save RDLC report in PDF format automatically in vb.net windows application.i try to many way but no use, i search the all google links oriented for this topic but i can't understated how it's doing, so pls send the easy vb.net code.
Posted
Updated 6-Jan-20 1:28am
v2

 
Share this answer
 
Comments
sv sathish 16-Aug-13 7:00am    
Thank you sir but in this link's not help full to me, because i am a beginner of the vb.net.
so pls send the easy code.
I Solve Myself:
my code is below
step:1
create a simple rdlc report add 2 textbox's and set the parameter in textbox1 and textbox2 the name of name1 and name2.

step:2
go to form 1 and add report viewer1,double click the form and paste the below code.

Imports Microsoft.Reporting.WinForms
Imports System.IO

Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim param(1) As ReportParameter
param(0) = New ReportParameter("name1", "abc")' name1=parameter in relc report, "abc"= 'value of name1"it's user defined"
param(1) = New ReportParameter("name2", "abc")'same as name1
Me.ReportViewer1.LocalReport.SetParameters(param)
Me.ReportViewer1.RefreshReport()
Me.ReportViewer1.LocalReport.DataSources.Clear()

Dim byteViewer As Byte() = ReportViewer1.LocalReport.Render("PDF")
Dim saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.Filter = "*PDF files (*.pdf)|*.pdf"
saveFileDialog1.FilterIndex = 2
saveFileDialog1.RestoreDirectory = True
Dim newFile As New FileStream("C:\Users\SathishKumar\Desktop\New folder\myReport.pdf", FileMode.Create)
newFile.Write(byteViewer, 0, byteViewer.Length)
newFile.Close()
End Sub
VB
<pre lang="vb">

End Class





step: 3

Enjoy Coding:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900