Hi
I want to create a crystal report from the dataset that i have written code for. All the information on google i found is the crystal report using database. I am not using any database. I have created table as below
Now i want to generate a crystal report from the dataset (ds) that i have created.Code:Public Class Form1 Private Sub Print_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print.Click Dim Table1 As DataTable Table1 = New DataTable("Customers") 'creating a table named Customers Dim Row1, Row2, Row3 As DataRow 'declaring three rows for the table Dim FirstName As DataColumn = New DataColumn("FirstName") 'declaring a column named Name FirstName.DataType = System.Type.GetType("System.String") 'setting the datatype for the column Table1.Columns.Add(FirstName) 'adding the column to table Dim LastName As DataColumn = New DataColumn("LastName") LastName.DataType = System.Type.GetType("System.String") Table1.Columns.Add(LastName) Row1 = Table1.NewRow() 'declaring a new row Row1.Item("FirstName") = fname.Text.ToString 'filling the row with values. Item property is used to set the field value. Row1.Item("LastName") = "Notebook" Table1.Rows.Add(Row1) Dim ds As New DataSet() 'creating a dataset ds.Tables.Add(Table1) 'adding the table to dataset 'filling the row with values. adding a product pfname.Text = Table1.Rows(0).Item("FirstName") End Sub End Class




Reply With Quote