Microsoft Reports w CSharp


S

squeezebot

I have a form with a report viewer and a combo box. I'm trying to get
the report result to "filter" based on the choice in the combo box.

From reading on using data in dot NET, I saw that you could bind a
control (like the report viewer) to a BindingSource object, while the
object is bound to the dataset.

Since the BindingSource object has a filter capability, I chose to
change that and refresh the report, but no filtered results, just the
original full set of data.

I put a datagridview below the report viewer and bound the grid to the
BindingSource object.
When I applied the change from the combo box, the datagridview changed
(as claimed from article I read) and the results filtered as expected.

Some code:

rptBindingSource.Filter = "pkID_Discipline = " +
comboBox1.SelectedValue;
rptViewer.RefreshReport();

The first line causes the datagridview to filter, but not the report.

Any ideas?
 
Ad

Advertisements

R

rimblock

Its a shot in the dark, but have you tried setting .Filter after you
Refresh?

HTH,
James.
 
Ad

Advertisements

S

squeezebot

Its a shot in the dark, but have you tried setting .Filter after you
Refresh?

HTH,
James.










- Show quoted text -

You mean reverse the entry or repeat it like....

rptBindingSource.Filter = "pkID_Discipline = " +
comboBox1.SelectedValue;
rptViewer.RefreshReport();
rptBindingSource.Filter = "pkID_Discipline = " +
comboBox1.SelectedValue;

This did not work. Same amount of records.

I'm totally blown away that someone is not familiar with this.
Is this the right forum to post to, for this issue?

TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top