• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 542
  • Last Modified:

MS report viewer

I face a trouble to find a sample to how create or use Ms report viewer with .rdlc and reportviewer by wpf vb code.

I know how to create rdlc report but not how to conneced with ms report viewer in WPF enviroment usng Vb code and how to pass parameter to it.


Could by please provide me the sample.


Thanks
0
abdallah1973
Asked:
abdallah1973
  • 4
1 Solution
 
abdallah1973Author Commented:
The sample is not useful

I tried to do it but I can't

I am looking for basic sample to how run Ms report viewe by WPF form.
I have report and I need just to show it in the form and code by vb.net
0
 
abdallah1973Author Commented:
I done the below
<Window x:Class="reports"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

       
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:viewer="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
xmlns:dalsi="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"

    Title="reports" Height="300" Width="300" Name="Window1">
    <Grid  Height="266">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="81*" />
            <ColumnDefinition Width="4*" />
            <ColumnDefinition Width="126*" />
            <ColumnDefinition Width="89*" />
        </Grid.ColumnDefinitions>
        <WindowsFormsHost Margin="0,34,0,0" Grid.ColumnSpan="4">
            <viewer:ReportViewer x:Name ="reportViewer1" />
        </WindowsFormsHost>
    </Grid>
</Window>

 and it's can use the control of report viewer but how to show my rdlc report

0
 
abdallah1973Author Commented:
Not it's work  I done this code
but it's now not show data

it's show report without data

 Private taCust As New OMSDataSetTableAdapters.CustomerTableAdapter '.CustomerTableAdapter ' CustomerDataSetTableAdapters.CustomerTableAdapter
    Private taManager As New OMSDataSetTableAdapters.TableAdapterManager
    Private View As CollectionView

    Private Sub Window1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        Me.taCust.Fill(Me.CustomerData.Customer)

        'Dim x33 As New ReportDataSource(Me.CustomerData.Customer)

        'Dim OMSDataSet As class_sample2.OMSDataSet = CType(Me.FindResource("OMSDataSet"), class_sample2.OMSDataSet)
        ''Load data into the table Customer. You can modify this code as needed.
        'Dim OMSDataSetCustomerTableAdapter As class_sample2.OMSDataSetTableAdapters.CustomerTableAdapter = New class_sample2.OMSDataSetTableAdapters.CustomerTableAdapter()
        'OMSDataSetCustomerTableAdapter.Fill(OMSDataSet.Customer)
        'Dim CustomerViewSource As System.Windows.Data.CollectionViewSource = CType(Me.FindResource("CustomerViewSource"), System.Windows.Data.CollectionViewSource)
        'CustomerViewSource.View.MoveCurrentToFirst()

        Dim my1 As String = "C:\Users\HP\Desktop\2010\first lessaon\2D\class_sample2\class_sample2\report1.rdlc"
        'AppDomain.CurrentDomain.BaseDirectory.ToUpper & "report1.rdlc"


        Me.reportViewer1.LocalReport.ReportPath = my1
        Dim x222 As New System.Data.DataTable("customerdataset")

        ' Me.reportViewer1.LocalReport.DataSources.Add(x33)
        Me.reportViewer1.LocalReport.DataSources.Clear()
        Me.reportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("customerdataset", x222))
        Me.reportViewer1.RefreshReport()

        'x33.Value = "tcust"


        'reportViewer1.LocalReport.DataSources.Add()
        'Me.reportViewer1.RefreshReport()
        '        'Dim report111 As New Microsoft.Visual
        '        'Me.WindowsFormsHost1.Child().add()
        '        WindowsFormsHost windowsFormsHost = new WindowsFormsHost();


        '        Dim reportviewer As New reports
        ',
        '        reportviewer.Show()

        'reportViewer = new ReportViewer(); windowsFormsHost.Child = reportViewer;
        'this.Viewer = windowsFormsHost and in the View I am using a ContentPresenter to display it, by binding to the Property that holds the WindowsFormsHost.

        ' <ContentPresenter Content="{Binding Viewer}" ...
    End Sub



and the xaml

<Window x:Class="reports"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

       
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:viewer="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
xmlns:dalsi="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"

    Title="reports" Height="300" Width="300" Name="Window1">
    <Grid  Height="266">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="81*" />
            <ColumnDefinition Width="4*" />
            <ColumnDefinition Width="126*" />
            <ColumnDefinition Width="89*" />
        </Grid.ColumnDefinitions>
        <WindowsFormsHost Margin="0,46,0,0" Grid.ColumnSpan="4">
            <viewer:ReportViewer x:Name ="reportViewer1" />
        </WindowsFormsHost>
    </Grid>
</Window>
0
 
abdallah1973Author Commented:
good
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now