Pass form parameters to the reportview and generate proof with the information in Visual basic.net

Asked

Viewed 190 times

0

All I want is to pass the parameters to the reportview and generate a voucher with the information that is in the text fields. what I can’t do is pass the parameters... I have an example in c# however and VB.net can’t.

Example in c#

impressao impressao = new impressao (pesobruto.Text, pesomolhado.Text, pesofundido.Text, teor.Text, finododia.Text, precograma.Text, nomecliente.Text, totalfino.Text, total.Text, dateTimePicker4.Text, porcentagem.Text);  impressao.Show();

namespace ControleGastos
{
public partial class impressao : Form
{
    public impressao( string pesobruto, string pesomolhado, string pesofundido, string teor, string finododia, string precograma, string nomecliente, string totalfino, string total, string data, string porcentagem)
    {
        InitializeComponent();

        reportViewer1.LocalReport.DataSources.Clear();

        reportViewer1.LocalReport.ReportEmbeddedResource = 
"ControleGastos.Report1.rdlc";
        Microsoft.Reporting.WinForms.ReportParameter[] p = new Microsoft.Reporting.WinForms.ReportParameter[11];


        p[0] = new Microsoft.Reporting.WinForms.ReportParameter("pesobruto", pesobruto);
        p[1] = new Microsoft.Reporting.WinForms.ReportParameter("pesomolhado", pesomolhado);
        p[2] = new Microsoft.Reporting.WinForms.ReportParameter("pesofundido", pesofundido)
;
        p[3] = new Microsoft.Reporting.WinForms.ReportParameter("teor", teor);
        p[4] = new Microsoft.Reporting.WinForms.ReportParameter("finododia", finododia);
        p[5] = new Microsoft.Reporting.WinForms.ReportParameter("precograma", precograma);
        p[6] = new Microsoft.Reporting.WinForms.ReportParameter("nomecliente", nomecliente);

        p[7] = new Microsoft.Reporting.WinForms.ReportParameter("totalfino", totalfino);
        p[8] = new Microsoft.Reporting.WinForms.ReportParameter("total", total);
        p[9] = new Microsoft.Reporting.WinForms.ReportParameter("data", data);
        p[10] = new Microsoft.Reporting.WinForms.ReportParameter("porcentagem",porcentagem);


        reportViewer1.LocalReport.SetParameters(p);

        reportViewer1.LocalReport.Refresh();

        reportViewer1.Refresh();

Someone can help me. need only pass the parameters of the text fields to the reportview and generate proof with the information that are in the text fields....

1 answer

0

From what I understand your reportview is a class, no? Just instantiates it with a constructor with arguments. In VB, the constructor is called by the following method:

Public Sub New(byval arg1 as tipo1, byval arg2 as tipo2,...)

End Sub

Browser other questions tagged

You are not signed in. Login or sign up in order to post.