473,411 Members | 1,949 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,411 software developers and data experts.

Listview and crystal report.

27 16bit
is possible to create a Crystal Report instead a datareport1 with the recordset rsTest?
Naturally without external database

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub GetListViewData(lv As ListView)
  3. Dim i As Integer
  4. Set rsTest = New ADODB.Recordset
  5. With rsTest.Fields
  6. .Append "Field1", adBSTR
  7. .Append "Field2", adBSTR
  8. .Append "Field3", adBSTR
  9. .Append "Field4", adBSTR
  10. End With
  11. rsTest.Open
  12. For i = 1 To lv.ListItems.Count
  13.     With rsTest
  14.         .AddNew
  15.         .Fields("Field1") = lv.ListItems(i).Text
  16.         .Fields("Field2") = lv.ListItems(i).SubItems(1)
  17.         .Fields("Field3") = lv.ListItems(i).SubItems(2)
  18.         .Fields("Field4") = lv.ListItems(i).SubItems(3)
  19.         .Update
  20.     End With
  21. Next i
  22.  
  23. Set DataReport1.DataSource = rsTest
  24. With DataReport1.Sections("Section1")
  25. .Controls("Text1").DataField = "Field1"
  26. .Controls("Text2").DataField = "Field2"
  27. .Controls("Text3").DataField = "Field3"
  28. .Controls("Text4").DataField = "Field4"
  29. End With
  30. DataReport1.Refresh
  31. DataReport1.Show 1
  32.  
  33. End Sub
  34. Private Sub Command1_Click()
  35. Call GetListViewData(ListView1)
  36. End Sub
  37. Private Sub Form_Load()
  38. ' Set listview
  39. With ListView1
  40.     .View = lvwReport
  41.     .FullRowSelect = True
  42.     .ColumnHeaders.Add , , "Id", 1100
  43.     .ColumnHeaders.Add , , "First Name", 1400
  44.     .ColumnHeaders.Add , , "Last Name", 1400
  45.     .ColumnHeaders.Add , , "Email", 1700
  46. End With
  47. ' Insert Data
  48. With ListView1.ListItems
  49.     .Add , , "1"
  50.     .Item(1).SubItems(1) = "Andre"
  51.     .Item(1).SubItems(2) = "White"
  52.     .Item(1).SubItems(3) = "Andre@White.com"
  53.  
  54.     .Add , , "2"
  55.     .Item(2).SubItems(1) = "Danny"
  56.     .Item(2).SubItems(2) = "Burnett"
  57.     .Item(2).SubItems(3) = "Danny@Burnett.com"
  58.  
  59.     .Add , , "3"
  60.     .Item(3).SubItems(1) = "Edward"
  61.     .Item(3).SubItems(2) = "Carter"
  62.     .Item(3).SubItems(3) = "Edward@Carter.com"
  63.  
  64.     .Add , , "4"
  65.     .Item(4).SubItems(1) = "Anne"
  66.     .Item(4).SubItems(2) = "Witter"
  67.     .Item(4).SubItems(3) = "Anne@Witter.com"
  68.  
  69.     .Add , , "5"
  70.     .Item(5).SubItems(1) = "Vicky"
  71.     .Item(5).SubItems(2) = "Myron"
  72.     .Item(5).SubItems(3) = "Vicky@Myron.com"
  73. End With
  74. End Sub
  75.  
  76.  
May 10 '20 #1
1 2702
You can pass an ADO.NET data source in to crystal and report off it. There are many, many articles dealing with how to do this, so I wont document it here.

Check out:

http://developer.emc.com/developer/d...DO_Dataset.pdf http://www.sdn.sap.com/irj/boc/go/po...idelayout=true http://msdn.microsoft.com/en-US/libr...=vs.80%29.aspx
May 12 '20 #2

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...
7
by: Phin | last post by:
I need your HELP! I've seen all the posts on using Crystal Reports within vs.net (vb.net) and changing a SQL query at runtime. When I tried to pass in a dataset into the crystal report at...
2
by: Mythran | last post by:
In .Net, how can I go about and set a Crystal Reports namespace? Right now they use the Root Namespace (VB) from the project. How can I extend the namespace for a single report (which will be set...
2
by: Karun Karunakaran | last post by:
Hi, I am using the Crystal Enterprise .NET assemblies to generate and display a crystal report in a webform. This report connects to an SQL server (running locally) using a specific username and...
1
by: bthomas71chevy | last post by:
I have just setup a WebServer and all the applications work fine, but when every any of the applications try to generate a Crystal Report the page errors out. "File or assembly name...
0
by: Ray | last post by:
Dear all, I have some questions about the Crystal Report and vb.net 2003. 1. I have installed the crystal report 10 and vs.net 2003. Should I update the crystal report within the vb.net so as to...
2
by: Jason Huang | last post by:
Hi, The Crystal Report bundled with .Net 2003 is version 9. How do I update the Crystal Report V9 in my .Net 2003 to Version 11 so that whenever I open a .rpt file in my VS 2003, the Crystal...
0
by: John Smith | last post by:
Hello, I am developing a VB.NET 2003 application that will use lots of Crystal Reports. Sometimes the users will preview a report in a Crystal report viewer, and sometimes they will send the...
11
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I stop receiving this message while calling a crystal report? "The report you requested requires further information." Thanks
0
by: apeg | last post by:
Hi Guys. I have a problem in displaying the data in my report viewer which is crystal report based on the value of checkbox. When i select and check multiple item that i want to print, only one item...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.