Solved

MS report viewer

Posted on 2011-02-12
5
476 Views
Last Modified: 2012-06-27
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
Comment
Question by:abdallah1973
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 34880758
0
 

Author Comment

by:abdallah1973
ID: 34899736
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
 

Accepted Solution

by:
abdallah1973 earned 0 total points
ID: 34900461
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
 

Author Comment

by:abdallah1973
ID: 34901274
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
 

Author Closing Comment

by:abdallah1973
ID: 37956119
good
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question