how to connect crystal report with vb.net ?

Answer Posted / kafeel ahmad

Take crystal report from toolbox .Take New form (I named it
frmRpt)Then take crystal report Viewer from tool box and
place it on new form(frmRpt) I named crystal report Viewer
as crptVW
double click on newform(frmRpt) and place this code---

Public Class frmRpt
Public strRptName As Object
Public strRptFilter As String
Private Sub frmRpt_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
If strRptFilter <> "" Then
crptVW.SelectionFormula = strRptFilter
End If
crptVW.ReportSource = strRptName
crptVW.Show()
End Sub
End Class


now if u want to call it on button_click then paste this
code on that button_click event ------

Dim objRpt As New frmRpt
objRpt.strRptName = New crList
' objRpt.strRptFilter = "{ConsultantMaster.ConId}="
& cboConIDX.SelectedValue 'if want to filter
objRpt.Show()

'now u can open as many crystal report just paste code
above on button_click()

Is This Answer Correct ?    8 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to deploy vb.net with key and evaluation time? any one can help me?

1952


how many server control present in .net

2498


What is the importance of a Button control?

1077


thak you Mr Govind for replying to my question. My next question is that how to retrieve image stored in an SQL server table and assign it to any image control or picture control using VB.net

1868


List the different types of assembly?

724


When do you use virutal keyword?

766


Explain the components of common language runtime.

756


How many ways the function can return values?

743


Explain jit?

729


what is the need for dynamic controls in vb.net? i would like to know for what purpose should we create the controls dynamically? please give the answer in simple words.

2173


What are the difference between dispose(), close(), exit(), end()? When do we use them?

782


What is the differnce between managed code and unmanaged code?

730


Write a VB.Net console program to check whether a number is perfect or not.

7284


what is interface and when it is used?

2008


What’s the difference between private and shared assembly?

878