Results 1 to 6 of 6

Thread: Crystal Report 9 & VB.net 2002

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    carmi,IL.
    Posts
    105

    Crystal Report 9 & VB.net 2002

    Hello:

    I am trying to learn vb.net (I came from vb6), I have ordered several books but none are in yet.

    This is all I need at this time.

    I have two forms in my project, form1 will have a button with code in it to call form2 which will have my CRViewer on it. (I can't ever figure out how to call form2 to show.

    The CRViewer will open up my one report. Please can someone give me some code examples?

    Thank you for your help
    David M. Camp

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question Re: Crystal Report 9 & VB.net 2002

    Can you explain your question again actually I am not able to understand your question.
    Are you want to make CR with the CRViewer in the Vb.Net?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    carmi,IL.
    Posts
    105

    Re: Crystal Report 9 & VB.net 2002

    I will try.

    I have already created my report with Crystal report 9. The report name is "InvoiceTotals.rpt" the database connection & selection formula is already saved in the report.

    I have created a vb project with just 2 forms. Form1 will just have a button on it (Nothing else) Form2 will have CRViewer on it set up to show the above report.

    I need the code that when I press the Button on form1 it will Show form2 and the Crviewer will display my above report.

    Thank you again.

    I hope this is better.
    David M. Camp

  4. #4
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: Crystal Report 9 & VB.net 2002

    In the method you are using two forms, so it is not the good programming, Use the crystal report control. And see all the report on the one form. Read the crystal report tutorial at my signature for more detail.
    Want to say one more thing that you are saying about the vb and the thread title .net so what is this.??

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    carmi,IL.
    Posts
    105

    Re: Crystal Report 9 & VB.net 2002

    I want to thank your for trying to help.

    The Crystal report tutorial you have a link to is for vb6.

    I am using Visual Studio.Net 2002 (VB.Net)

    Can you provide a VB.Net and Crystal Report Tutorial?

    Thanks Again.
    David M. Camp

  6. #6
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: Crystal Report 9 & VB.net 2002

    There is difference between the connection with the Access and the SQL server.
    Just click on the Database connection at my signature for connection with the database either sql server of ms access.
    Related to the crystal report Just use the code, and change the connection and the SQL query according to your condition.



    VB Code:
    1. Dim CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer = New CrystalDecisions.Windows.Forms.CrystalReportViewer
    2.         Dim Report As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
    3.         CrystalReportViewer1.ActiveViewIndex = 0
    4.         CrystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    5.         CrystalReportViewer1.DisplayGroupTree = False
    6.         CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill
    7.         CrystalReportViewer1.Location = New System.Drawing.Point(0, 0)
    8.         CrystalReportViewer1.Name = "CrystalReportViewer1"
    9.  
    10.         Dim QueryString As String = "select * from TableName" 'Your Query here and the table name
    11.         Dim Connection As New OleDbConnection(funcs.con) 'Your Database Connection Here
    12.         Connection.Open()
    13.  
    14.         Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter(querystring, connection)
    15.         Dim DataSet As DataSet = New DataSet() 'DataSet
    16.         Adapter.Fill(DataSet)
    17.         Dim DataTable As DataTable = New DataTable 'DataTable
    18.         DataTable = DataSet.Tables(0)
    19.         Report.Load(Application.StartupPath & "/ReportName.rpt") 'Report Name Here
    20.         Report.SetDataSource(DataTable)
    21.         CrystalReportViewer1.ReportSource = Report

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width