Hi Sirs!
Could you try to think with me this problem please:
I have two forms, on form1 (I use one "textbox1") and on form2 where there is my reportview tool with one "textbox1" also.
Now what I am doing? when I insert for example a name in textbox1 of the form1 and I press on my button to open the form2. Automatically, its transfert the textbox value of form1 to the form2's textbox1. Suddlently its make a filter and previsualize my report. Until there its work perfectly.
But and but when I insert (or write) a name to do the same find its give me this error message:
Cannot access a disposed object.
Object name: 'ReportViewer'.
Its doesnt give the error message when after to insert a name and show the report. Then when I stop the program and restart... And write other name. Its doesnt give that message. I am not sure if I am clearm with explanation. Have a look:
// the first form using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace FactuModelo
{
public partial class Facturacao : Form
{
Form2 f2;
public Facturacao()
or
{
InitializeComponent();
}
private void btnPrevisualizar_Click(object sender, EventArgs e)
{
if (f2 == null)
f2 = new Form2();
f2.ValueFromFacturacao(txtbxName.Text);
f2.Show();
}
}
}
--------------
//the secong form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace FactuModelo
{
public partial class frmRptFactura : Form
{
public frmRptFactura()
{
InitializeComponent();
}
public void ValueFromFacturacao(string value)
{
textBox1.Text = value;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
this.factura_modeloTableAdapter.Fill(this.DSFactura.factura_modelo, textBox1.Text);
this.reportViewer1.RefreshReport();
}
}
}