I changed your code a bit and it now looks like
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cryRpt As New ReportDocument
cryRpt.Load("C:\Users\sim\Documents\Visual Studio 2008\Projects\Crystal Reports Date parameter\Crystal Reports Date parameter\CrystalReport1.rpt")
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
Dim crParameterDiscreteValue As ParameterDiscreteValue
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("Orderdate")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New ParameterDiscreteValue
crParameterDiscreteValue.Value = TextBox1.Text
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
If you want to add more parameters copy statements between
Begin parameter
and
End parameter
. Then change the parameter name and the values used and it should work.
As for the fact that all line from 01-May-2011 and onwards are shown will have to do with how the data is selected. Make sure that you not only check if the
Orderdate
is larger than the date but also smaller than the end of the month (in this case 31-May-2011).