Solved

MS report viewer

Posted on 2011-02-12
5
466 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
Comment Utility
0
 

Author Comment

by:abdallah1973
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
good
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now