Home » Microsoft Technologies

Importing Microsoft.Reporting.WinForms into Console Application Project



I've created a VB Console Application Project and am trying to instantiate a Report Viewer object. To my understanding I need to import Microsoft.Reporting.WinForms however Visual Studio does not recognize this name space. Is there some reference I need to add?





4 Answers Found


Answer 1

You have to add reference to Microsoft.ReportViewer.WinForms  in order to use Microsoft.Reporting.WinForms  .

Right click on your project in solution explorer, and select add reference,  In reference window, select NET Tab and try to look for Microsoft.ReportViewer.WinForms






Answer 2

He wasn't copying the code.  Even if he used the word 'imports' which my guess is he did this error would be the result.  If he left off the 's' it would be a different error.

That said, I don't know the solution.  Is there a reference (.dll) that needs to be pointed to?


Answer 3

i edited my first post. try it that should work. What VS are you using?



Answer 4

That worked! Thanks so much. I'm using Visual Studio 2010. I had looked in references before but I guess I must have skipped over that one :P.


Thanks : )





If I add a reportviwer control to a windows from I get an error message :- 

 Error 4 Value of type 'Pipeline.Microsoft.Reporting.WinForms.ReportViewer' cannot be converted to 'System.Windows.Forms.Control'. D:\Development\BT PMO Pipeline\Pipeline\Pipeline\Project_Report.Designer.vb 38 25 Pipeline.

Error 4 'LocalReport' is not a member of 'Pipeline.Microsoft.Reporting.WinForms.ReportViewer'. D:\Development\BT PMO Pipeline\Pipeline\Pipeline\Project_Report.Designer.vb 30 9 Pipeline


The basic code to load the report is:


'Imports Microsoft.Reportviewer







PrivateSub Project_Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)






PrivateSub Project_Report_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load







Any ideas much appreciated.




1) Create Reports Project in VS2010

2) Wizard appears

3) Select Service in Chose Data Source Type window

4) Type your WcfDataService uri and add service reference

5) Press "Finish" in Chose Data Source Type window

6) See nothing added in ReportWizard window, DataSource and Available DataSets are empty.

So, what should I do to make it work? My service is working perfectly in WPF application, but I decided to create a reporting part of my solution with Microsoft Reports project.


Hy .. i'm little stuck with this error. can anyone help me? I'm a bit rockie in vb.


  'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim ReportDataSource1 As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FrmRapDiagnostice))
        Me.ReportViewer1 = New Microsoft.Reporting.WinForms.ReportViewer
        Me.OdbcSelectCommand1 = New System.Data.Odbc.OdbcCommand
        Me.adpRapDiagnostice = New System.Data.Odbc.OdbcDataAdapter
        Me.conexiunediagnostice = New System.Data.Odbc.OdbcConnection
        Me.DSdiagnostice = New appPractica.DSdiagnostice
        Me.TableBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        CType(Me.DSdiagnostice, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.TableBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()


Hey all,


Where can I find the .dll for Microsoft.ReportViewer.Winforms v9.0 or later. I'm asking because I'm having a problem with targeting the .NET 2.0 framework from VS2010. Every other dll works perfectly fine but this one seems to stay at version 10 which is having a problem with .NET 2.0. 


Thanks in advance.


Hi, I have installed VS2008 + Team Explorer plus SP1.

When I do File New Project and create a Windows Form Project or a Class Library project, I have a "Data" menu with Show Data sources (shift+alt+d), and can get to the Data sources pane, create data sources, etc.

In Web Application Project, I cannot see this menu.  When I use customize to add the menu item, it's disabled.

This thread seems to be relevant: http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/b48c7969-17bf-4626-bcff-0fdfcac62321.

Should I expect the Data Sources pane to be available in Web Applications project?



I am looking for help on how to create a report with multiple subreports in a Winforms project using VB.NET in Visual Studio 2010.

I want to use List controls, not Tablix controls in the reports.

I want to fill a multi-table dataset once, so it isn't necessary to make a trip to the server for each main record.

I checked GotReportViewer.com but that didn't help much. 

I would appreciate any recommendations.




Hi All,


I am trying to generate a business object report through a 2.0 .Net console application.

I have referenced the business object SDK but not able find which is the way to go, please help. Thank you

I have a console app that hosts several WF services and would like to launch the test client when I hit debug. As far as I can tell there is no way to do so. 

The options seem to be 
Start Project
Start External Program

Is there a built-in way to do both??


Im using Windows Vista Premium with SP2 and ESET Smart Security 4...and Visual C++ 2008 Express Edition

When i try to create a Visual C++ win32 Console application project ( file>new>project>win32>win32 console application), a popup is shown which says
" Navigation to the webpage was canceled
   what you can try:
   Retype the address. "

....Plizz HELP....

i have uploaded a screen video for details (7MB)



I write you since I've got a problem with a console application I need to use to generates a lot of reports .. the total report is almost 18.000,

I've got a console application that call's 3 different WCF Service (using net.tcp) and (actually tries to) generate the reports

Here's the task I use to generate :


  public override void DoWork()
      Task[] tasks = new Task[ListaRapporti.Count()];

      for (int i = 0; i < ListaRapporti.Count; i++)
        int idRapporto = ListaRapporti.ElementAt(i);
        Task<RenderingResult[]> rootTask = GetReportInBynaryFormatTask(idRapporto);

        Task<TestA> ConcatenaTask = rootTask.ContinueWith((Task<RenderingResult[]> antecedent) =>
            TestA classeA = new TestA();

            byte[] byteFileConcatenati = null;

            int pageCount = 0;
            //Li concatento
            byteFileConcatenati = ConcatenaLettera_a_Rendiconto(antecedent.Result[0].DocumentBytes, antecedent.Result[1].DocumentBytes, out pageCount);

            classeA.IDRapporto = idRapporto;
            classeA.BytesDaScrivere = byteFileConcatenati;
            classeA.PageCount = pageCount;

            return classeA;

        Task<string> taskWriting = WriteReportToPdfTask(ConcatenaTask);

        tasks[i] = taskWriting;

      catch (AggregateException ex)
        Console.WriteLine("Aggregate exception : la crazione del report : ", ex.Message);
        foreach (Exception inner in ex.InnerExceptions)
          Console.WriteLine("Eccezione durante la crazione del report : ", inner.Message);
          //     LogManager.GetLogger("ExceptionLogger").LogException(LogLevel.Error,string.Empty, inner);

After some time I get this error :  System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host, the problem seems to occur randomly and it's related to net.tcp connection... I've tried to set the listenbacklog to 200 in web.config but haven't succeded in...anyone can tell me what should I trace/check do drill down in this problem?






Hi Team,
I facing parse error, application used to work week earlier and then it started showing error. Can some one help me? I tried following steps provided with similar error postings but of no uses.

Parser Error body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Server Error in '/Reports' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'Microsoft.ReportingServices.UI.GlobalApp'.

Source Error:

Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="Microsoft.ReportingServices.UI.GlobalApp" %>

Source File: d:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportManager\global.asax    Line: 1

Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407

I need to figure out a way to programatically determine whether code is being called from a console application or a WinForms application (or even WPF).  The scenario is, a .net DLL library needs to know what kind of application is calling it.  Is this possible?

I am trying to run a WPF application from a console application (e.g. a .bat file) but need to be able to receive console and error output from the WPF application.

I have console.writeline() and console.error.writeline commands in the WPF application but these are not received by the console application.

I would also like to receive a status value from the WPF on completion.

Is this possible?

If so could you give me a simple example using VB?


Hello everyone, on the project I'm on, we have opted for a plugin architecture where each WPF component is compiled as a library.  A taskbar-like UI also written in WPF serves as the main UI with buttons that will call each individual UI component when triggered.

The location of each library is defined in an XML file, which is then looped through our PluginManager.  We then call the Application.Run(), which is a Windows.Form function call.

When we found that our TextBoxes no longer accepts certain inputs (well noted for those who did interop between WinForms and WPF) we realized there must be another way to start the Application that doesn't require use of WinForm function call.  We tried calling the Application.Current.Run() (the WPF version), and though the taskbar shows up, it immediately crashed with a NullRef exception.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using OurCustom.Plugins;

namespace Test
 internalstaticclass Program
  privatestaticvoid Main()
   //Loads the plugins

   //Starts the message loop


So basically we changed the Application.Run() portion to Application.Current.Run(), removed the ref to WinForms and added PresentationFramework and WindowsBase.  Now we're getting NullRef Exception on that Application.Current.Run() even though the taskbar did show up.

Please let me know if more info is needed.  We currently have a workaround solution but it isn't pretty...it involves enabling KeyboardInterop in to the ElementHost in order for the TextBox to behave properly.  There must be a more straightforward solution to this issue.  Thanks in advance.


Cheers, DJWP


How can I center align the report shown in a report viewer control?

What I wanted was to show the report the same way as presented when in "Print Layout" mode, but must allow user interaction for sorting and drill-through.



How can I import Access reports in a vb.net project in Visual Studio 2010?

at the moment i've uploaded few Projects on MS Project Server 2007. But now I want to Import those Projects to MS Project Server 2010. Further I don't want MS Project server 2007 any other Settings . ( Ex. Users , Resources etc ) . any body know that how can we do it ?
We have an application that when developed 5-6 years ago was C++/MFC docu view architecture. We long ago stopped using the GUI and now what to make this a strictly command line driven application. Essentially remove the MFC code and get as close to native C++ as possible.

Are we looking at win32?

We are concerned with sheer speed as this is a computational application which we run thousands of multiyear scenarios. How do we get to continue to use CString.

We will be using Visual Studio 2008.


I have a few questions regarding the GUI applications.  I am aware that Console applications are non-event based programs which do not have the pretty GUI interface.

Having done C/C++ on *nix with a main() as the entry point and in Windows 3.1 with WinMain as the entry point into the application, I am trying to figure out the entry point into the VB application.  I am trying get back into programming after several year so please be patient with my ignorance. :-)

In the VB console application the entry point is pretty clear.  There is the "Sub Main()" in the main Module.  In the GUI applications, where is the entry point?  If you created 3 seperate required Forms for an application, which form serves as the entry point into the application?

Hope to get some clear explanation.

PS - I did get the VB 2010 book from Rod Stephens today and did not find the answer to my question.  It seems to be more WPF and VB focused.  Looks like a good book though.


Hey all,


How do I add a reference to Microsoft.Reporting.Winforms v9.0 to a VS2010 project. I want to do this because I am currently target .NET 2.0.


Thanks all


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure