Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 3.5 and Visual Studio. 2008 > Visual Studio 2008
|
Visual Studio 2008 For discussing Visual Studio 2008. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2010, 06:00 PM
Authorized User
 
Join Date: Feb 2010
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default VBNET2008 Crystal Report Text Object, New Line

Hi Good Guys

I have using VBNET2008, Crystal Report 10, SQL SERVER 2000, NorthWind Database for testing purposes.

I have an interesting problem and need your help and suggestions.
It's how to create a NEW LINE at the end of filling the last TEXT OBJECT.

I have created CrystalReportInvoice.Rpt and embedded it onto VBNET2008 FORM via CrystalReportViewer. I was requested to use Crystal Report TEXT OBJECT for 3 columns of data to be filled by DATAREADER which consist of 7 rows of data.

The probem is only one Row was display instead of the 7 rows on the Crystal Report because the row override the one before it because no NEW LINE was created. I did not get it working with the coding (BLUE HIGHLIGHTED)

Here are the coding.

Code:
 Private Sub btnShowReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowReport.Click
    
        Dim strSql As String = Nothing

        strSql &= "Select  OrderID,  OrderDate, ProductName" 
        strSql &= " From Invoices "
        strSql &= " Where CustomerId = '" & txtcustId.text & "' "
   
        sqlConn = New SqlConnection(connStr)
        sqlCmd = New SqlCommand(strSql, sqlConn)
        sqlConn.Open()
        sqlDR = sqlCmd.ExecuteReader

        ' ---- setup crystal Report option and TEXT Pbject defination ---- '
        Dim objRpt As New CrystalOrderInvoice
        Dim cryTextObject As TextObject = Nothing
        Dim FmulaNewLine As FormulaFieldDefinition = Nothing

        Dim cryFolder As String = "H:\VBNet2008CrystalReportApps\CrystalOrderInvoice.rpt"
   
        objRpt.Load(cryFolder)
        Me.CrystalReportViewer1.ReportSource = objRpt
        Me.CrystalReportViewer1.Visible = True

        While sqlDR.Read

            ' --- OrderID
            cryTextObject = objRpt.ReportDefinition.ReportObjects("ctxtOrderId")
            cryTextObject.Text = sqlDR("OrderID")

            ' --- OrderDate
            cryTextObject = objRpt.ReportDefinition.ReportObjects("cTxtOrderDate")
            cryTextObject.Text = sqlDR("OrderDate")
 
            ' --- productname
            cryTextObject = objRpt.ReportDefinition.ReportObjects("cTxtProduct")
            cryTextObject.Text = sqlDR("ProductName") 

            ' --- new line  
            FmulaNewLine = objRpt.DataDefinition.FormulaFields("FmulaNewLine")
            FmulaNewLine.Text = Chr(10) & Chr(13)    
        End While
  
       sqlconn.Close

    End Sub 

Please help me by listing step by step procedures to create a NEW LINE as I am new to Crystal Report..

Once I got it working, I will post the solution here to share with other Newbies who may have similar problems.
__________________


Thank you very much.

Have a good day.

Cheers,
Lennie

Last edited by Lennie; March 20th, 2010 at 06:05 PM.. Reason: TYPO ERROR
 
Old March 30th, 2010, 07:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

r u going to fill all list by a while loop & ....
come on man go & use dataSet & ...
read my old posts
__________________
Always,
Hovik Melkomian.
 
Old March 30th, 2010, 07:44 PM
Authorized User
 
Join Date: Feb 2010
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default VBNET2008 Crystal Report Text Object, New Line

Hi MelVik,

"ALSalamWalaiKum"

Quote:
Originally Posted by melvik View Post
r u going to fill all list by a while loop & ....
come on man go & use dataSet & ...
read my old posts

--------------------------------------------------
I am following my IT Development Manager who requested using DATAREADER to fill Crystal Report TEXT OBJECT instead of binding Tables to it or using DATASET1.XSD.

His reason is because for the past 2 months there are constant changes to the data display of the Crystal Report and it cost alot of time to make changes to VB.NET Program and Crystl Report. So by using DATAREADER changes is only made to the SQL String that retrieve the data from SQL SERVER.

Originally, I was using DATASET to fill Crystal Report DATASET1.XSD

By the way, where about is your old post?
I would love to have a look and learn new things from there. Thanks.


Thank you for your response. I do need your help.



Cheers,
Lennie
__________________


Thank you very much.

Have a good day.

Cheers,
Lennie





Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report XI Buseness Object error shahhussain Classic ASP Professional 0 September 29th, 2008 11:53 AM
multiple line chart in crystal report ganans BOOK: Professional Crystal Reports for VS.NET 1 September 25th, 2006 12:13 PM
create a Line object ,Box object in CR at Runtime? thanhnt Pro VB 6 1 May 16th, 2005 06:51 AM
Makeing a Crystal report through a data object saad Crystal Reports 0 December 15th, 2004 08:53 AM
Rotating Text in Crystal Report ashish_26 Crystal Reports 0 September 29th, 2004 01:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.