How to Create Crystal Report using Visual Studio 2012 Part 1
Get link
Facebook
X
Pinterest
Email
Other Apps
-
How to Create Crystal Report using Visual Studio
This tutorial will focus on creation of Crystal Report using Visual Studio 2012. To accomplish this you will require to have:
Microsoft Visual Studio 2012.
MySQL.
SAP Crystal Reports version for visual studio 2012.
For the purpose of this tutorial, we will be using VB.Net. To start create a vb.net project
Open visual studio (2012) and create a new project.
Creating a new project
2. Select VB.NET then click on Windows Forms Application. Give it a name as shown in item 3 in the screenshot below. Finally click OK.
Now your project is set. You can now start the process of integrating it with Crystal Reports. 3.Right click on the name of your project. Click Add and then New Item.
4. Add New Item dialog box will appear. Under Common items select Data tehn select Dataset. Give it a name and click Add as shown below.
Selecting Dataset
5. A Dataset Designer comes up. Right-click on it and select Add then Click on TableAdapter.
Dataset Designer
6. A TableAdapter configuration wizard comes up.
TableAdapter Configuration Wizard
7. If you had not set the connection, it's time to do so. Click the New Connection button. In the Change Data Source dialog box that will appear, select Microsoft ODBC Data Source and click OK.
Selecting Data Source
A new dialog box will pop up. This is the Add Connection dialog box. Under Data source, it's already indicated the datasource that you selected above. If you wish to change, click the Change... button and select a corresponding datasource. Under Data source specification, select Mysql. Proceed and key in your login information; this being the username and password you use to login to yous Mysql database. Click the Test Connection button to see whether the detais you provided are collect; if they are, you will get a message stating that the connection is successful. Click OK.
Adding connection
8. Choose a command type and click Next. Here you declare whether your TableAdapter will use SQL statement or a stored procedure. In our case, our TableAdapter will use an SQL statement. So we select the Use SQL statement option and then we click Next.
Choosing command type
9. Next enter SQL statement or alternatively use the Query Builder to build your desired query. We take the second option.
10. Select tables to be used and click Add.
Add Table
11. Select fields that will appear in the dataset. Do so by ticking the square to the left of each field name. Click OK and then click Next.
Fields selection
12. The TableAdapter Configuration Wizard appears. The purpose of the TableAdapter methods is to load and save data between your application and the database. Choose methods to generate e.g. Fill and click Next. Finally click FINISH.
TableAdapter Configuration Wizard
So far so good. It's time to create a report.
Proceed to the next part by following the link below:
How to paste image into picturebox from clipboard with VB.Net If you wish to paste an image into a picturebox from clipboard for your VB.Net project, this is what to do: 1. Add a picturebox to your form. 2. Add a button and copy paste the code below. Private Sub btnPastePic_Click(sender As Object, e As EventArgs) Handles btnPastePic.Click 'If My.Computer.Clipboard.ContainsImage Then ' PictureBox1.Image = My.Computer.Clipboard.GetImage 'End If Dim idata As IDataObject = Clipboard.GetDataObject() If idata.GetDataPresent("System.Drawing.Bitmap") Then Dim imgObject As Object = idata.GetData("System.Drawing.Bitmap") If imgObject IsNot Nothing Then Dim img As Image = TryCast(imgObject, Image) If img IsNot Nothing Then PictureBox1.Image = img End If End If End If
Creating A New Report In our part one tutorial , we saw how to prepare create a new VB.NET project which we will use in creating and displaying our crystal reports. In this part, we will see how to create the Crystal Report inside VB.NET. 1. Under your project name, right-click and select Add then click New Item. Under Reporting, select Crystal Reports. (Remember we started by installing Crystal Reports for VS 2012 . If you missed this step, please refer to this tutorial here ) 2. Give your Report a name and click Add. The diagram below shows the four steps to follow in naming the report and adding it. Once you click Add, you will be taken to Crystal Reports Gallery. 3. In the Crystal Reports Gallery select one of the three options; in our case, we will pick option 2 which is As a Blank Report. So select As a Blank Report. Then under Choose an Expert, select Standard. Finally, click OK button. 4. Back now to your workspace. With the report open(th
Comments
Post a Comment