I probably have wrong assigned question.Look...
I Have a created crystal Report document (invoice)... this document have many parameters
t.e. Name,address,phone,tax rate and other... and have binded to Datatable, which includes information about goods,quantity,cost and other... this all works fine... and this i do with this code.
Dim rptobj As New rpt_Invoice ' my invoice sceleton
Using tblInvoice As New DataTable
'DataTable to bind
tblInvoice.Columns.Add("ANAME", GetType(String))
tblInvoice.Columns.Add("CNT", GetType(Double))
tblInvoice.Columns.Add("CNTSTR", GetType(String))
tblInvoice.Columns.Add("OUT_PR", GetType(Double))
For Each row As Datagridviewrow In rowCol
Dim Drow As Data.DataRow = tblInvoice.NewRow
Drow.Item("ANAME") = DBNullBug(row.Cells("ANAME").Value)
Drow.Item("CNT") = row.Cells("DECCNT").Value
Drow.Item("CNTSTR") = row.Cells("CNT").Value
Drow.Item("OUT_PR") = row.Cells("SOLD_PR").Value
tblInvoice.Rows.Add(Drow)
Next
'Params to pass
Dim RPTParams As New Hashtable
RPTParams.Add("NDS", OPT.Item.NDSValue)
RPTParams.Add("INVOICENUM", "")
RPTParams.Add("INVOICEHIMQ", "")
RPTParams.Add("KATPASHT1", "Director")
RPTParams.Add("KATPASHT2", "Accountant")
RPTParams.Add("VCHPASHT1", "Director")
RPTParams.Add("VCHPASHT2", "Accountant")
RPTParams.Add("ADATE", CDate(Now))
RPTParams.Add("INFO", "")
RPTParams.Add("ORDER_ID", Order_Id)
Dlg_RepPreview.STable = tblInvoice
Dlg_RepPreview.SParams = RPTParams
Dlg_RepPreview.rep = rptobj
Dlg_RepPreview.ShowDialog()
End Using
And the form called "Dlg_RepPreview" has rep variable (reportdocument) and STable (DataTable),SParams as Hashtable (hashtable with parameters).
on the Form_Load i writen this code
Private Sub Dlg_Rep_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
RP_Viwer.ReportSource = rep ' RP_Viwer is my ReportViewer
If STable IsNot Nothing Then
rep.SetDataSource(STable) ' setup datasource
End If
For Each Param As ParameterField In rep.ParameterFields ' set parametervalues
If SParams.ContainsKey(Param.Name.ToUpper) Then
rep.SetParameterValue(Param.Name, SParams(Param.Name.ToUpper))
Else
rep.SetParameterValue(Param.Name, Param.DefaultValues())
End If
Next
RP_Viwer.Zoom(75)
RP_Viwer.Refresh()
End Sub
in this form i have a button. when user clicks on that button, openes the dialog form,with all paramteres and values in report (without datasource).User be able to change parameter values (e.t.c address,phone,name) except datasource (e.t.c goods,quantity,cost).
I cant do that. i try code something as simple as this:
rep.SetParameterValue(Param.Name, Param.value)
rep.Refresh()
RP_Viwer.Refresh()
but this code does not work...How i can do ???