Solved

MS report viewer

Posted on 2011-02-12
5
474 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
  • 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

786 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