473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Create New Row after filling a row of TEXT OBJECT

126 100+
Hi there,

Using VBNET2008, Crystal Report 9, SQL SERVER 2000, Northwind database for application purposes.

The CrystalReportInvoice.RPT was embedded onto VBNET2008 FORM via CrystalReportViewer1 whose datasource was not connected to table or dataset.

As requested by Team Leader, 3 Crystal Report TEXT OBJECT were inserted in the Crystal Report SECTION DETAILS which are filled with data using DATA READER which consist of 7 rows of data but only one row was display because the DATAREADER Row override the row before it becaues no NEW LINE was created .

Here are the coding

Expand|Select|Wrap|Line Numbers
  1.  Private Sub btnShowReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowReport.Click
  2.  
  3.         Dim strSql As String = Nothing
  4.  
  5.         strSql &= "Select  OrderID,  OrderDate, ProductName" 
  6.         strSql &= " From Invoices "
  7.         strSql &= " Where CustomerId = '" & txtcustId.text & "' "
  8.  
  9.         sqlConn = New SqlConnection(connStr)
  10.         sqlCmd = New SqlCommand(strSql, sqlConn)
  11.         sqlConn.Open()
  12.         sqlDR = sqlCmd.ExecuteReader
  13.  
  14.         ' ---- setup crystal Report option and TEXT Pbject defination ---- '
  15.         Dim objRpt As New CrystalOrderInvoice
  16.         Dim cryTextObject As TextObject = Nothing
  17.         Dim FmulaNewLine As FormulaFieldDefinition = Nothing
  18.  
  19.         Dim cryFolder As String = "H:\VBNet2008CrystalReportApps\CrystalOrderInvoice.rpt"
  20.  
  21.         objRpt.Load(cryFolder)
  22.         Me.CrystalReportViewer1.ReportSource = objRpt
  23.         Me.CrystalReportViewer1.Visible = True
  24.  
  25.         While sqlDR.Read
  26.  
  27.             ' --- OrderID
  28.             cryTextObject = objRpt.ReportDefinition.ReportObjects("ctxtOrderId")
  29.             cryTextObject.Text = sqlDR("OrderID")
  30.  
  31.             ' --- OrderDate
  32.             cryTextObject = objRpt.ReportDefinition.ReportObjects("cTxtOrderDate")
  33.             cryTextObject.Text = sqlDR("OrderDate")
  34.  
  35.             ' --- productname
  36.             cryTextObject = objRpt.ReportDefinition.ReportObjects("cTxtProduct")
  37.             cryTextObject.Text = sqlDR("ProductName") 
  38.  
  39.           ' --- new line  
  40.               FmulaNewLine = objRpt.DataDefinition.FormulaFields("FmulaNewLine")
  41.             FmulaNewLine.Text = Chr(10) & Chr(13)   
  42.  
  43.      End While
  44.  
  45.        sqlconn.Close
  46.  
  47.     End Sub
  48.  
  49.  
  50.  
  51.  Private Sub btnShowReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowReport.Click
  52.  
  53.         Dim strSql As String = Nothing
  54.  
  55.         strSql &= "Select  OrderID,  OrderDate, ProductName" 
  56.         strSql &= " From Invoices "
  57.         strSql &= " Where CustomerId = '" & txtcustId.text & "' "
  58.  
  59.         sqlConn = New SqlConnection(connStr)
  60.         sqlCmd = New SqlCommand(strSql, sqlConn)
  61.         sqlConn.Open()
  62.         sqlDR = sqlCmd.ExecuteReader
  63.  
  64.         ' ---- setup crystal Report option and TEXT Pbject defination ---- '
  65.         Dim objRpt As New CrystalOrderInvoice
  66.         Dim cryTextObject As TextObject = Nothing
  67.         Dim FmulaNewLine As FormulaFieldDefinition = Nothing
  68.  
  69.         Dim cryFolder As String = "H:\VBNet2008CrystalReportApps\CrystalOrderInvoice.rpt"
  70.  
  71.         objRpt.Load(cryFolder)
  72.         Me.CrystalReportViewer1.ReportSource = objRpt
  73.         Me.CrystalReportViewer1.Visible = True
  74.  
  75.         While sqlDR.Read
  76.  
  77.             ' --- OrderID
  78.             cryTextObject = objRpt.ReportDefinition.ReportObjects("ctxtOrderId")
  79.             cryTextObject.Text = sqlDR("OrderID")
  80.  
  81.             ' --- OrderDate
  82.             cryTextObject = objRpt.ReportDefinition.ReportObjects("cTxtOrderDate")
  83.             cryTextObject.Text = sqlDR("OrderDate")
  84.  
  85.             ' --- productname
  86.             cryTextObject = objRpt.ReportDefinition.ReportObjects("cTxtProduct")
  87.             cryTextObject.Text = sqlDR("ProductName") 
  88.  
  89.             ' --- new line  
  90.             FmulaNewLine = objRpt.DataDefinition.FormulaFields("FmulaNewLine")
  91.             FmulaNewLine.Text = Chr(10) & Chr(13)
  92.  
  93.         End While
  94.  
  95.        sqlconn.Close
  96.  
  97.     End Sub
  98.  
Mar 20 '10 #1

✓ answered by MrMancunian

Hi Lennie,

I spent almost an entire day on getting your solution even to run, but without any result. I give up, perhaps someone else?

Sorry.

Steven

19 5016
MrMancunian
569 Expert 512MB
For as far as I can see, you refill the same objects over and over again in your loop.You should create the new objects within your While...End While-loop.

Try

Expand|Select|Wrap|Line Numbers
  1. cryTextObject = New objRpt.ReportDefinition.ReportObjects("ctxtOrderId ")
  2. etc...

Steven
Mar 23 '10 #2
lenniekuah
126 100+
Hi Awesome MrMancunian
Thank you again for your information. I will try it out. Once I got it working I will post the coding here to share with Newbies who have the same approach.

You are very awesome.

Cheers,
Lennie
Mar 23 '10 #3
lenniekuah
126 100+
Hi MrMancunian

I amended the codes by adding the word NEW
cryTextObject = New objRpt.ReportDefinition.ReportObjects("ctxtOrderId ")
cryTextObject = New objRpt.ReportDefinition.ReportObjects("cTxtOrderDa te")
cryTextObject = New objRpt.ReportDefinition.ReportObjects("cTxtProduct e")

It generated this error message to my surprise.

Type 'objRpt.ReportDefinition.ReportObjects' is not defined.
Mar 23 '10 #4
MrMancunian
569 Expert 512MB
Can you put up your complete solution for download? Then I can try it at my own PC :-)

Steven
Mar 24 '10 #5
lenniekuah
126 100+
Hi MrMancunian,
I have extracted all the coding and pasted on WORD Document. How to download it so that you have try it ? Do you mean paste the coding here as I have initially done it when I asked for help ?

I don't see any Attachment Button opton here.


Cheers,
Lennie
Mar 24 '10 #6
MrMancunian
569 Expert 512MB
Hi Lennie,

Just ZIP your complete solution and put it up for download at rapidshare or something alike :-) Then send me the URL...

Steven
Mar 25 '10 #7
lenniekuah
126 100+
Hi MrMancunian,
I have no idea of any Internet Server where I can download my zip files
Mar 25 '10 #8
MrMancunian
569 Expert 512MB
Take a look at http://www.rapidshare.com/...

Steven
Mar 25 '10 #9
lenniekuah
126 100+
Hi MrManCunian,

Thank you very much for your offer to help me. You are very awesome person.
I have download it as VbNet2008Crystal.zip in the http://www.rapidshare.com/...

Here is the URL Link:

http://rs102tl.rapidshare.com/cgi-bi...04693242865787

Prior to download, I was testing almost similar application developed by another progammer and I encounter this error message from Crystal Report Viewer:- AxCrystalActiveXReportViewer1


With Me.AxCrystalActiveXReportViewer1
.ReportSource = cryRpt <--- generate error "This value is Write-only "
.Refresh()
End With

Thank you for your help.

Have a Good Day,

Cheers,
Lennie
Mar 26 '10 #10
lenniekuah
126 100+
Hi MrManCunian,
Lennie here,
How's my downloaded ZIP application regarding Crystal Report TEXT OBJECT ?
Can you please get back to me with information ?

Thanks
Mar 28 '10 #11
MrMancunian
569 Expert 512MB
Hi Lennie,

I've been away for a few days, so I wasn't able to respond. I will download your solution right away and get back to you soon :-)

Steven
Mar 31 '10 #12
MrMancunian
569 Expert 512MB
Lennie,

The link you posted is dead...Click it yourself and you'll see. Perhaps you posted the wrong link?

Steven
Mar 31 '10 #13
lenniekuah
126 100+
Hi MrMancunian,

Good to meet you again. It's wonderful that you have a break.
I have uploaded the ZIP file again and the URL LINK is listed beow


1. Download Link: Click here to download file

http://rapidshare.com/files/37022395...ystal.zip.html
MD5: F8FDE4F259734A4682E18729D263BD11
Mar 31 '10 #14
MrMancunian
569 Expert 512MB
Ok, can you hook me up with the following libs?

- AxCRVIEWER9Lib
- CRVIEWER9Lib

Steven
Mar 31 '10 #15
lenniekuah
126 100+
Here is the URL Link

1. Download Link: Click here to download file

http://rapidshare.com/files/37025391...alDLL.zip.html
MD5: CD6D0D9516E15F64F013209FB6DB7D40
Mar 31 '10 #16
MrMancunian
569 Expert 512MB
Hi Lennie,

I spent almost an entire day on getting your solution even to run, but without any result. I give up, perhaps someone else?

Sorry.

Steven
Apr 2 '10 #17
lenniekuah
126 100+
Hi MrMancunian,

Thank you very much for spending your precious time trying to solve my coding problems. Please do not feel bad about it without the solution. I really appreciate your effort trying to help me. You are a very awesome person.

Once I got the coding working and running, I will share it with you and other Newbies by posting it here.

Here is the explanation why using Crystal Report TEXTOBJECT. Instead of creating alot of Crystal Reports for transactions reporting, it's better to use TEXTOBJECTs ( Eg. txtData1, txtData2, txtData3, txtData4, txtData5, etc...)

With these txtData as TEXTOBJECT name it creates the Crystal Report very flexible. The various Progams that extraction different transactions from SQL SERVER use DATAREADER and fill the rows of records into txtDATA object.

That will save the company development time and cost.

I am hoping that some VB.NET Crystal Report Developer will share their knowledge of how to create a new row after fill the txtDATA object instead of override the txtDATA objects like its happening right now. Instead of displaying 7 rows of data it display only the last row as it overrides the row before it.

Have a Good Day, MrMancunian.
Apr 3 '10 #18
MrMancunian
569 Expert 512MB
Hi Lennie,

Perhaps you can find something at the Crystal Reports forum: http://www.crystalreportsbook.com/Forum/.

Steven
Apr 3 '10 #19
lenniekuah
126 100+
Hi MrMancunian,

I did submit the problem to the URL link and until today I have not received any response from them. I am not sure they did not responsed to it.
Nevetheless, I will logged on to the URL Link to check it out.

Thank you very much for the URL Link.
Apr 4 '10 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
3
by: Stig | last post by:
I'm having two tables with no relation and I want to list them both in one report. How can I do this. I have tried to use sub report, but cant get it to work? can someone please help me. If I just...
1
by: Rutko | last post by:
Is it possible to dynamically create report and save it in rpt file? For example I want to add an text object in report on x,y position in page header. I need that dynamically, because I have a...
1
by: Karthic | last post by:
When i right click on the .rpt file in the VS 2003, i see a property printer setting. It says "No printer" on the top and there is option to select printer and paper settings etc.. I want to...
3
by: Deasun | last post by:
I need some help please! Crystal is driving me nuts. Heres my code so far, see below. Problem: On the .export() line it comes back with error #5 Login failed! I know the login info is good so...
3
by: Milan Todorovic | last post by:
Hello, I need help. I have experience in ASP.NET programming, but this is my first dealing with Crystal Reports. I'm trying to make the most basic report purely for testing purposes: connect to...
3
by: dekern | last post by:
Good afternoon all, I guess I am missing the benefit of using datasets with Crystal. For years I have written wrapper apps that used the Pull method and I let Crystal do all the sql work. Now...
1
by: Rodo | last post by:
Hi all, I'm trying to generate a simple crystal report without a database. Several people mention the use of a dataset. Someone mention in a msdn forum that I could use the SetParameterValue to...
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
3
by: firozfasilan | last post by:
I am new to visual basic 2008. In the past I have used vb6 to display an existing crystal report. I would like to accomplish the same with vb.net. However I am not clear on the syntax to display a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.