DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2007
    Vancouver, BC

    Crystal Report Viewer

    Hi Everyone,

    On a form I have a Checked List Box. I want to select multiple values as parameters to send to a Crystal Report. This code works fine if I only select one list item, but if I select two, it only sends the second one. Any suggestions? Thanks.

    Private Sub btnShowWorksheet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowWorksheet.Click
    Dim intCounter As Integer = Nothing 'Counter fo "For...Next Loop"
    Dim myParameterFields As New ParameterFields() 'Collection of Parameters
    Dim myParameterField As New ParameterField() 'Parameters = Checked container ids
    Dim myDiscreteValue As New ParameterDiscreteValue() 'Transfers container id to parameter

    myParameterField.EnableAllowMultipleValue = True
    myParameterField.Name = "ContainerNumber" 'Name of field

    If cbxContainers.CheckedItems.Count <> 0 Then
    For intCounter = 0 To cbxContainers.CheckedItems.Count - 1 'For loop adds each
    myDiscreteValue.Value = cbxContainers.CheckedItems.Item(intCounter) 'checked container to
    myParameterField.CurrentValues.Add(myDiscreteValue) 'parameter group
    End If
    myParameterFields.Add(myParameterField) 'adds all parameters to 1 collection
    CrystalReportViewer1.ReportSource = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Whiteboard\Whiteboard\OpeningWorksheet.rpt"
    CrystalReportViewer1.ParameterFieldInfo = myParameterFields
    End Sub

  2. #2
    Join Date
    Mar 2007
    Vancouver, BC
    Never mind, I figured it out. I just had to juggle a Dim statement. Thanks anyways!

Similar Threads

  1. Replies: 2
    Last Post: 01-27-2007, 06:28 AM
  2. alignment of report in crystal report viewer
    By jabbarsb in forum ASP.NET
    Replies: 1
    Last Post: 06-29-2006, 05:30 AM
  3. Working with Crystal Report Ver 10
    By AM003295 in forum VB Classic
    Replies: 4
    Last Post: 08-12-2005, 09:13 PM
  4. Replies: 1
    Last Post: 06-14-2002, 03:49 PM
  5. Replies: 2
    Last Post: 06-08-2002, 11:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.