Help: How To View Selected Items From Listview With Crystal Report Viewer
Hi
I have a Listview with check boxes from it want to view selected items with crystal report viewer.
Private Sub cmdView_Click() Dim lCustomerId as Long Dim tmpItm As ListItem For Each tmpItm In lstItems.ListItems If tmpItm.Checked = True Then lCustomerId = Val(Replace(tmpItm.Key, "C", "")) End If Next
End Sub
Plz. help
regards
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Editing Selected Item In ListView In Report View
How can I edit the second column of data in a listview control? I am making a properties box much like the one you use in VB. The first column information for each item can not be editable but the second column is going to be the value for each item and I need for it to be able to click and type in it just like in VB (or at least similar to that).
Any help and sample code is appreciated. Thanks.
ListView (Report View) - Adding Items
AH! This is embarassing yet very frustrating. The last time I worked with the list view control was a loooong time ago. Unfortunately, I lost that project when my computer crashed (no big deal really, the program was never even completed). At any rate, how the heck do I add subitems and items to a report view listview?!
eg
Column 1 Column 2
Add Item Add Item
Add Item Add Item
List View Selected Items In Text Boxes
Dear Friends,
When I select one item {because I have only one coloumn in listview } (eg: Name) from a listview which is connected to DB2.MDB (Table Name is : TB2) and displays the data from TB2, I would like all the text boxes to show all the records pertaining to the selected name. I have four fields in TB2.
What code should be written:
Listview Selected Items
hey i was wondering if it is possible to retrieve a collection of selected items from a listview which has multiselect set to true
(not checked, but selected)
i was hoping i could do something like this ...
Code:
dim li as listitem
for each li in listview1.selecteditems
' do something
next li
... but it doesn't appear to be so easy
any hints ?
thanks,
huby.
Getting Value Of Selected Items In Listview
Hey ya'll,
I'm trying this code for :
when user selects multiple rows in a listview and then wants them printed on one printout! (that's the idea anyhow!)
code :
Dim X As Object
Dim i As Integer
Dim db As Database
Dim rs As Recordset
Dim vaOsTime As String
Dim vaOsDate As String
vaOsTime = Time
vaOsDate = Date
If ListView1.SelectedItem Is Nothing Then Exit Sub
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Selected = True Then
Dim strSource, strCaption, strText As String
Dim strFooker As String
Dim strDBName As String
Dim strPepp0, strPepp2, strPepp3
strDBName = DBPath()
strFooker = ListView1.ListItems(i).SubItems(1)
strSource = "SELECT * FROM Class4 WHERE Detalj
LIKE '" & strFooker & "'"
End If
Next i
ActiveClassView.DAODataControl1.DatabaseName = strDBName
ActiveClassView.DAODataControl1.RecordSource = strSource
ActiveClassView.Label14 = Date
ActiveClassView.Label15 = Time
ActiveClassView.Printer.Orientation = ddOLandscape
ActiveClassView.Show
Users only get the first row selected printed, can anyone help me to get all rows selected printed?
//Patrick
Getting Selected Items In ListView?
Hi All,
Here's the deal: I have a TreeView and a ListView that operate just like Explorer. I'm trying to loop through the contents of my ListView for any given directory and if an item is selected then I want to add the name of the item to an array (In most cases, just file names). Sounds simple
The problem is that when I have this for example:
ListView Contents
Code:
FolderOne
FolderTwo
FileOne
FileTwo
FileThree
If I were to select the three files and attempt to perform the code below this is whats happends.--> The first file is added to the array (good). On the second time through the For/Next loop it seems that the 'Selected' item is now 'FolderTwo' instead of 'FileTwo' (bad). Does this make sense?!? (see the code below)
Code:
Dim i As Integer
Dim FSO As Object
Dim FileChg As Object
Dim FilesToChange() As String
Dim H As Integer
Dim FilePath As String
Form1.MousePointer = 11
'Set the File System Object
Set FSO = CreateObject("Scripting.FileSystemObject")
'Get the path of the selected files
FilePath = Mid(TreeView1.SelectedItem.FullPath, 23, 2) & Mid(TreeView1.SelectedItem.FullPath, 26)
Debug.Print FilePath
'loop through the listview items and count the selected ones
H = 0
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Selected = True Then
H = H + 1
End If
Next
Debug.Print H
'redim the array to the number of selected files
ReDim FilesToChange(1 To H) As String
'loop through the files in the filelistbox and for the selected files
'add them to the array
H = 1
For i = 1 To ListView1.ListItems.Count 'On the second time through I have the problem stated above
If ListView1.ListItems(i).Selected = True Then
Debug.Print ListView1.ListItems.Item(i)
FilesToChange(H) = "" & ListView1.ListItems.Item(i)
H = H + 1
Debug.Print FilesToChange(H)
End If
Next
Thx
Cyphin
~Of all the things I've lost, I miss my mind the most.~
~Iz vseh veshei chto ya poteryal, ya bol'she vsego skuchayu po rassudku.~
Edited by - Cyphin78 on 8/22/2003 10:56:35 AM
Getting ALL The Selected Items From A Listview
Ok, so I've got a ListView in Report mode, and im trying to get the keys of all the selected items in the ListView.
My original code just loops through all the items, and records the selected ones...
Code:
ReDim sDBIDs(0)
For x = 1 To grdItems.ListItems.Count
If grdItems.ListItems(x).Selected = True Then
If sDBIDs(0) = "" Then
sDBIDs(0) = grdItems.ListItems(x).Key
Else
ReDim Preserve sDBIDs(UBound(sDBIDs()) + 1)
sDBIDs(UBound(sDBIDs)) = grdItems.ListItems(x).Key
End If
End If
Next x
like so. Its currently fired from the MouseUp event, so that clicking a single item or using the "SHIFT + Click" or "CTRL + Click" method of selecting multiple items both run the code.
Problem is, this doesnt work for Drag selecting items, because for some reason the MouseUp event isnt fired in that case.
So 2 questions really...
1/ how do i get the code to fire when drag selecting
2/ Is there an easier/faster/less brute force method of doing it.
Cheers
Xeno
Get The Selected Items In Listview
hi all.
whats the way of getting all the selected items(multiselect=true) in a listview?
do i have to iterate all of the items in my listview???
thanks.
Passing Crystal Report Or Viewer A Value Used For Filtering The Report
I having a problem trying to filter out my crystal report based on a case number which is a primary key in my access table tblCaseInfo. I am trying to do this through vb.net so when the user is viewing a particular case they can click the print button and print only that particular case being viewed. The case number will be coming from a textbox (txtCaseNumber.text) on the form in vb.net.
As of right now when the print button is clicked every case in the database is displyed in the crystal report viewer to be printed.
I have three tables involved:
tblCaseInfo - VictimID, AssailantID are foreign keys for the table listed below
tblVictimInfo - VictimID Primary Key
tblAssailantInfo-AssailantID Primary Key
Only code I have so far:
Private Sub btnPrintSurveyReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintSaveSurveyReport.Click
frmSurveySummaryReportInstance.ShowDialog()
End Sub
Identifying Selected Items In A Listview
Hello all,
I have a listview set to multiselect. In VB code how can you identify each record that has been selected/highlighted? I know how to identify individual selected items but not multiple.
Thanks in advance!
-Chadzuk
Determining No Selected Items In A Listview
I have two listviews, you can select one item between the two othem and I need to know how to determine which view has the selected item in. I can think of a round about way of determining (add a global variable that says which is selected with the itemclick event) but would rather know the proper way.
Highlight Selected Items In The Listview
I have DT Picker and use listview to display the date and the activities.. When I pickup the date from DTPicker, It list the date and the activities in the listview
For example when I pickup the 27/7/2007 from DTPicker, It list the date 27/7/2007 in the listview. How I can highlight the that date in the listview?
Code:
On Error Resume Next
Dim newDate As Date
Dim newDate1 As Date
rec.MoveFirst
Do Until rec.EOF
If rec("hari") = "" Then
Set lvItem = lvJadual.ListItems.Add(, , "")
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
'lvItem.ListSubItems.Add , , "" & rec("hari")
'Isnull(rec("hari")) ialah test untuk tengo kalau nilai yang dibaca dpd field hari ialah null atau kosong
ElseIf IsNull(rec("hari")) Then
Set lvItem = lvJadual.ListItems.Add(, , "")
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
'lvItem.ListSubItems.Add , , "" & rec("hari")
Else
newDate = DateAdd("d", rec.Fields("hari").Value, DTPicker1.Value)
rec.Fields("start_date").Value = newDate
'rec.Fields("start_date").Value = Format(newDate, "dd/MM/yyyy")
newDate1 = DateAdd("d", rec("peruntukan") - 1, rec("start_date"))
'newDate1 = DateAdd("d", rec("peruntukan") - 1, newDate)
' rec("end_date") = Format(newDate1, "dd/MM/yyyy")
rec.Fields("end_date").Value = newDate1
Set lvItem = lvJadual.ListItems.Add(, , "" & Format(newDate, "dd/MM/yyyy"))
lvItem.ListSubItems.Add , , "" & (Format(newDate1, "dd/MM/yyyy"))
'lvItem.ListSubItems.Add , , "" & rec.Fields("end_date").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("peruntukan").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("aktiviti").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("sasaran").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("jenisinput").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("tindakan").Value
rec.Update
End If
rec.MoveNext
Loop
Remove Selected Items In The Listview.
How I can remove the selected items in the listview?
Code:
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems.Item(i).selected Then
'what should I put here
End If
Next i
Multiple Selected Items In A Listview
Hello, how can I find out how many selected items there are in a listview?
I'm showing a popup menu when the user right-clicks on an item, but I need to know if only 1 item is selected, so I can disable a menu option.
I've tried this, but it doesn't work.
VB Code:
If ListView.SelectedItem < 2 Then mnuCopyMultiple.Enabled = False
Determining No Selected Items In A Listview
I have two listviews, you can select one item between the two othem and I need to know how to determine which view has the selected item in. I can think of a round about way of determining (add a global variable that says which is selected with the itemclick event) but would rather know the proper way.
Count Selected Items In A ListView
This is making me crazy. There is no ListView ListCount. I can't figure out how to get the number of items selected in a ListView control.
Anyone?
ListView HighLight Of Selected Items
Dear All,
I am attempting to convert some ListBoxes to more interesting ListView controls. When a ListBox looses focus its selected items (rows) remain highlighted, but I am finding the highlight disappears in the ListView.
Is there a way to maintain highlight of selected items in the ListView control when focus is not on it.
regards Hugh,
Number Of Selected Items In Listview Wrong
Hi guys,
I'm working with a listview and i think it works wrong. If the user clicks on an empty row then will be another (not empty) automatically selected. Does someone observe this strage behaviour? I've tried to found the error and I find out that already
GetSelCountListView = SendMessage(lvw.hwnd, LVM_GETSELECTEDCOUNT, 0, 0)
returns a wrong value.
Sorry for my bad english and thanks for every help.
ListView With Checkboxes (capturing Selected Items)
Hi
I have a listview control with checkboxes and i want to capture those items that the user has checked. The multiselect property is set to true and the listview has a report view which is displaying FileName, Path, File Size, Date Modified - Column headers.
Can someone please help me on this one...
Thanx in advance....
Where Is Crystal Report Viewer?
Hi folks, i'm looking foward to print a crystal report but i'm having trouble finding the correct procedure. after looking at a few samples i noticed that every one is talking about crviewer but i can't find it anywhere, can someone help out on this? maybe i don't have the correct version of VB?
maybe someone can also give me a code sample on how to simply print the reports without having to view it.
Thanks again for the help!
Crystal Report Viewer From VB
I am about to write a program which will use Crystal Report viewer to grab reports and display them so that the users on site don't have to have crystal installed.
I would like to do this dynamically when they click on a *.rpt file.
I have worked out how to get my program to run when this happens but am not sure how to grab the 'filename' parameter which is generated (%1).
It' s probably really simple stuff but have not done this before - can anyone help?
Crystal Report Viewer
Hi friends,
How to use CRViewer to show report which is created using automation server. Please help with some sample code.
thanks in advance.
Thomas George
Crystal Report Viewer, Where Is It
I have crystal reports version 10. I install it and it adds alot of references and components, none of which I am sure does what. I have added the crystalactivexreport viewer since I cannot find any other viewer. I have then added this code
VB Code:
Dim Report As New CrystalReport1 Private Sub Form_Load()Screen.MousePointer = vbHourglassCRViewer1.ReportSource = "C: estCR 8.5
eport.rpt"CRViewer1.ViewReportScreen.MousePointer = vbDefault End Sub Private Sub Form_Resize()CRViewer1.Top = 0CRViewer1.Left = 0CRViewer1.Height = ScaleHeightCRViewer1.Width = ScaleWidth End Sub Private Sub Form_Unload(Cancel As Integer)Unload MeForm1.ShowEnd Sub
Apparently that is not anyway to do it cause no matter what I try it will not display the report. Any help would be appreciated.
Crystal Report Viewer
Hi all
I'm doing a project in VB6. I wanted tomake reports in Crystal Reprts 9. I have used prior versions of crystal reports before.
But using this version, I don't get any crystal report control in VB control component list. Ther I get only Crystal Report Viewer.
I created reports using crystal reports. but how can I display it thro' VB using Crystal Report Viewer?
Please help
Crystal Report Viewer
Hi
I have created one report (Invoice.rpt), now i want to display it in the Crystal Report Viewer Control. I am using Crystal Report 8.0. I am new to Crystal Report.
Please Help
Crystal Report Viewer And VB.NET
Could anyone tell me how to pass parameters in VB.NET 2003 to Crystal Report Viewer Control. Some lines of coding would be very much appreciated.
Crystal Report Viewer
i designed my report in crytal report, and i used a crytal report viewer on the form in VB6. i need the code to link the crystal report to the viewer and the code to view it
Crystal Report Viewer
Can any one point me to an example on how to use crystal reports in VB.I want to use CRViewer to display the report.
thanks
Crystal Report Viewer With VBA
Hello,
I'm starting to use the Crystal Report now and I'd like some tips to do a print report from data that already is available in a recordset.
I don't need to show the report I just need to print this with a predefined format.
Somebody could help me sending an example or where can I find some documentation about it?
Thanks a lot in advance.
Cleber Polli
Report Print Through Selected List View
hi,
help needed for
datareport print through listview
grouping of records
deacc is the data environment name
lvwtransactions is the list view name
rtreport is the datareport name
Code:
With deAcc
If .rsCommand3_Grouping.State = adStateOpen Then .rsCommand3_Grouping.Close
.Command3_Grouping Val(lvwTransactions.SelectedItem.Text)
rptStatement.Show
End With
Crystal Report Viewer Refresh
I know this has been answered many times on this form, but I can't seem to find an example like mine...and maybe that's because I'm going about it all wrong...you guys tell me.
The crystal report that I'm displaying is a stand alone crystal report based on one summary table (hitting oracle through odbc dsn). I want to replace the table that the report is based on with a sql statement (onclick of my report button) and then have the report viewer refresh the report link so that the most current version of the data is displayed in the viewer.
I can get the report to refresh at run time when clicking on the little yellow lightning bolt on the viewer...however, I would like for the viewer to refresh the report on the initial load of the report.
I've tried crviewer1.refresh and I get an error message that says "method'refresh' of object 'Icrystalreportviewer3' failed? However when I hit debug and then just hit run again from design mode, it does refresh the report.
thanks here's my code
Dim NETADCREATEQRY As String
Dim NETADDROPQRY As String
Dim crysApp As New CRAXDRT.Application
Dim selectedreport As String
Dim myRpt As CRAXDRT.Report
NETADDROPQRY = "DROP TABLE NETWORK_ADEQUACY_RPT;"
NETADCREATEQRY = "CREATE TABLE NETWORK_ADEQUACY_RPT AS SELECT DESCRIPTION, SUM((CASE SUBSTR(C.CCHP_RESTRICTIONS,1,1) WHEN '1' THEN 1 ELSE 0 END)) OPEN_PCPS, SUM((CASE SUBSTR(C.CCHP_RESTRICTIONS,1,1) WHEN '2' THEN 1 WHEN '3' THEN 1 ELSE 0 END)) CLOSED_PCPS, (CASE C.IPA_GROUP_NAME WHEN 'CCPN' THEN 'YES' Else 'NO' END) CCPN, COUNT(D.PROV_NO) TOTAL, SUM((CASE SUBSTR(C.CCHP_RESTRICTIONS,1,1) WHEN '1' THEN 1 ELSE 0 END))/COUNT(D.PROV_NO) PERCENT_OPEN FROM PHYDEMOGRAPHIC D, PHYSPECIALTY A, PHYADDRESS B, PHYLOB C, COUNTIES E WHERE D.PROV_NO = A.PROVNO (+) AND D.PROV_NO = B.PROVNO (+) AND D.PROV_NO = C.PROVNO (+) AND B.CTY_CODE = E.CODE (+) AND A.PRVTYP = 'PCP' GROUP BY (CASE C.IPA_GROUP_NAME WHEN 'CCPN' THEN 'YES' Else 'NO' END), E.Description ORDER BY (CASE C.IPA_GROUP_NAME WHEN 'CCPN' THEN 'YES' Else 'NO' END) DESC;"
' DROP AND RECREATE THE NETWORK ADEQUACY REPORT TABLE
With cmd
Set .ActiveConnection = con
.CommandType = adCmdText
.CommandText = NETADDROPQRY
End With
With rs
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.Open cmd
End With
With cmd
Set .ActiveConnection = con
.CommandType = adCmdText
.CommandText = NETADCREATEQRY
End With
With rs
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.Open cmd
End With
selectedreport = "J:ReportsGen30Completed_ReportsREPORTING DIRECTORYNETADEQ.rpt"
Set myRpt = crysApp.OpenReport(selectedreport)
Call myRpt.Database.Tables(1).SetLogOnInfo (mngp, , "mylogon", "mypwd")
With RPTS
.Show
Screen.MousePointer = vbHourglass
.CRViewer1.ReportSource = myRpt
.CRViewer1.ViewReport
.CRViewer1.Zoom 100
.CRViewer1.Refresh
Screen.MousePointer = vbDefault
End With
Closing Crystal Report Viewer
My crviewer is on a form I want to close the view but not the form.
I craeted a button to close the viewer with the code crviewer.closeview,
but I get an error message "Argument not optional" what am I doing wrong.
Crystal Report Viewer Beginner
I am a beginner in the field of Crystal Report Viewer and desprately need help.
I just want to load a report, insert the parameters and view the report, however it is playing silly beggers with me!
Can anyone tell my what i am doing wrong?
BELOW IS MY CODE:
Code:
If Not Session("InputParms") Is Nothing Then
Dim Parms() As String = CType(Session("InputParms"), String())
Dim strParmNames() As String = CType(Session("ParmNames"), String())
Dim i As Integer
Report.Load("C:Test EnvironmentsDGS Reports" & ddlDepartment.SelectedValue & "" & ddlReport.SelectedValue, OpenReportMethod.OpenReportByTempCopy)
For i = 0 To UBound(Parms) Step 1
Report.SetParameterValue(strParmNames(i).ToString, CObj(Parms(i).ToString))
Next
End If
Dim logoninfo As New TableLogOnInfo
Dim table As CrystalDecisions.CrystalReports.Engine.Table
For Each table In Report.Database.Tables
logoninfo = table.LogOnInfo
With logoninfo.ConnectionInfo
.ServerName = "DEV-ERPDBS"
.DatabaseName = "Test"
.UserID = "test"
.Password = "test"
End With
table.ApplyLogOnInfo(logoninfo)
Next
With crv
.ReportSource = Report
.Visible = True
End With
Thanks
Crystal ActiveX Report Viewer
VB 6 Enterprise; Crystal Reports XI Developer Edition
Is there any way to get rid of (not display) that hideous "Business Objects" icon in the upper right hand corner of the Viewer?
Thanks, Sam
Crystal 9 Report Viewer Progress Bar
Hi
I am confused about the crystal reports veiwer. When it is loading, which can take some time, I would like the user to be informed of the progress but this does not seme to happen. I have set the CRV.EnableProgressControl = True and it shows a progress bar at the top of the viewer but it sits there motionless.
I have had a search on the forum for any information on this but all I could find was something saying it was not possible to show a progress bar. Could this realy be the case?
If you can't show a progress bar is it possible to show something moving to keap the user entertained like:
Code:
CRV.ViewReport
CRV.EnableProgressControl = True
CRV.ReportSource = crxReport
CRV.ViewReport
CRV.Refresh
CRV.Visible = True
fraProgress.Visible = True
Me.Show , frmParent
frmParent.SetFocus
Incrament = 1&
Do While .CRV.IsBusy = True
DoEvents
Debug.Print "Loading "
PB.Value = PB.Value + Incrament
If PB.Value = PB.Max or PB.Value = PB.Min Then
'Show a Kit effect
Incrament = Incrament * -1&
End IF
PB.Refresh
Loop
fraProgress.Visible = False
But when I try this I get one debug print despite the load taking up to a minute!
Any help would be appeciated.
|