To create a report using Crystal Reports in Visual Basic for a database table named "siswa" with columns "id," "nama," and "alamat," you'll need to follow these steps:
Step 1: Create a Windows Forms Application
- Open Visual Studio 2015.
- Create a new Windows Forms Application project.
Step 2: Install Crystal Reports
If you haven't already installed Crystal Reports for Visual Studio, you can do so using the Visual Studio installer.
Step 3: Add a Crystal Report
- Right-click on your project in the Solution Explorer.
- Select "Add" > "New Item..."
- In the "Add New Item" dialog, search for "Crystal Reports."
- Select "Crystal Report" and name it, e.g., "SiswaReport.rpt."
- Click "Add."
Step 4: Design the Crystal Report
- In the Crystal Reports Designer, go to "Database" > "Database Expert..."
- In the "Database Expert" dialog, select your data source, usually "OLE DB (ADO)" for a database.
- Connect to your database and select the "siswa" table.
- Add the fields "id," "nama," and "alamat" to the report.
Step 5: Create a Form to Display the Report
- Add a Windows Form to your project if you don't have one.
- Drag and drop a CrystalReportViewer control onto the form. Resize it as needed.
- In the Properties window, set the ReportSource property of the CrystalReportViewer to your report, e.g., "SiswaReport.rpt."
Step 6: Load Data into the Report
You need to write code to load data from the database into the report. Here's a basic example using ADO.NET:
vb.net
Copy code
SS. Source code |
Replace "Your_Connection_String_Here" with the appropriate connection string to your database.
Step 7: Run the Application
Build and run your Windows Forms application, and the Crystal Report with data from the "siswa" table should be displayed in the CrystalReportViewer.
Make sure you have the necessary Crystal Reports runtime installed on the target machine if you plan to deploy the application outside of your development environment.
0 comments:
Post a Comment