Home Submit Snippets Cy2Online.Net  
Ads by Lake Quincy Media
 
 
 
View Snippet
VB.Net Controls CrystalReportViewer Example
Viewed: 221
Date: 2010-02-05
This code snippet shows how to create a report and use the CrystalReportViewer control to load the report.
View Snippet
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Windows.Forms
Imports CrystalDecisions.ReportSource
Imports System.Data
Imports System.Data.SqlClient
 
 
Public Class Form1
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
        Dim connectionString As String = "Data Source=DATA_SOURCE;Integrated Security=True"
        Dim sqlCon As New SqlConnection(connectionString)
        sqlCon.Open()
 
        Dim sqlCmd As New SqlCommand("SELECT * FROM CUSTOMER", sqlCon)
        Dim sqlAdapter As New SqlDataAdapter(sqlCmd)
        Dim CustomerDataSet As New DataSet()
        sqlAdapter.Fill(CustomerDataSet,"Customer")
 
        Dim ReportDoc As New ReportDocument
        ReportDoc.Load("CustomerProfile.rpt")
        ReportDoc.SetDataSource(CustomerDataSet.Tables("Customer"))
 
        CrystalReportViewer1.ShowRefreshButton = False
        CrystalReportViewer1.ShowCloseButton = False
        CrystalReportViewer1.ShowGroupTreeButton = False
 
        CrystalReportViewer1.ReportSource = ReportDoc
 
    End Sub
 
End Class
New Snippets
Title Language Category Views
Edit TreeNode Example 1 C# Controls 348
Multiple Insert With One Query SQL - MySQL Insert 143
Read Image File As Bytes Visual C++ File Manipulation 157
TcpClient PortScanner Visual C++ Network 79
TcpClient Example Visual C++ Network 109
Managed And Unmanaged Example Visual C++ Miscellaneous 69
XmlDocument Example Visual C++ XML 120
Reading A CSV File Visual C++ File Manipulation 153
StreamWriter Example Visual C++ File Manipulation 149
StreamReader Example Visual C++ File Manipulation 179
Edit GridView And Save Changes ASP.Net - C# Controls 266
GridView From DataTable ASP.Net - C# Controls 213
Radial Gradient Circle Example 2 VB.Net Graphics 143
Radial Gradient Circle Example 1 VB.Net Graphics 142
Check If User Is Administrator VB.Net Security 209
Encrypt Text Using TripleDESCryptoServiceProvider VB.Net Security 138
Hash Text Using SHA1Managed VB.Net Security 115
CrystalReportViewer Example VB.Net Controls 222
Drag Drop Image File Onto Form VB.Net Controls 228
Drag Drop A File Into TextBox VB.Net Controls 217
PrintPreviewControl Example VB.Net Controls 277
Nested DataRelation VB.Net Database 91
Play System Sound VB.Net Multimedia 156
Play Wav File VB.Net Multimedia 137
Semi Transparent Panel VB.Net Controls 206
Serialize Class To XML VB.Net File Manipulation 181
Get Hidden Files In Directory VB.Net File Manipulation 132
Simple PrintDocument Example VB.Net Controls 359
Reflection Example 1 VB.Net Miscellaneous 117
Insert Image Into RichTextBox VB.Net Controls 355
Show Image With Watermark VB.Net Graphics 162
Get Memory Information VB.Net File Manipulation 154
Get Runing Processes VB.Net Miscellaneous 100
FileSystemWatcher Example 1 VB.Net File Manipulation 178
DataTable To XML VB.Net Database 178
SqlDataReader To XML VB.Net Database 204
UDP File Transfer Example VB.Net Network 335
UDP Server Example VB.Net Network 289
UDP Client Example VB.Net Network 238
Read XML File From Web Server VB.Net Network 346
Ads by Lake Quincy Media
Top Snippets
Semi Transparent Panel - C#
This snippet shows how to develop a custom panel which is semi transparent by overriding CreateParams and the OnPaint method of the Panel control.
Get File Path - C#
TThis code snippet gets the filename and path of a selected file using the FileOpenDialog Class.
Add Items To ListView Control - C#
This snippet adds items to a listview control. It loops through the files in the C:\ drive and displays the filename in the listview control.
Encrypt Text Using TripleDESCryptoServiceProvider - C#
This snippet uses the TripleDESCryptoServiceProvider Class to encrypt a string and save it to a text file. The key to decrypt the file is also saved into a seperate text file.
Read Image File As bytes - C#
This sinppet opens an image for reading as bytes. The bytes are then placed into a memorystream which is used to create a bitmap image of the bytes. The image is then set as the forms background image.
Check If File Exists - C#
This snippet checks to see if a file exists using the FileInfo Class.
Get Filename Using OpenFileDialog - C#
This code snippet gets the filename of a selected file from the Open File Dialog and displays it in a message box.
Get IP Address - C#
This code snippet will get the computers IP address.
Connect To SQLServer - C#
This simple snippet creates a connection to an SQLServer.
Simple Editable Table Columns - Javascript
This snippet allows you to edit the cells of a table.