Change textbox size and location in Microsoft Report Viewer control.

Posted on 2012-09-07
Last Modified: 2012-09-28
I am developing a win forms application using dotnet framework 4.0 with C# and SQL server 2005. I am using visual studio 2010 as IDE. My application has several reports and i am developing it using Microsoft Report Viewer Control. I have several occassions in which i need to change the size and location of text boxes in report viewer dynamically. I have googled a lot and didn't get any reliable solution. Please help me to find out a solution
Question by:syosys
    LVL 19

    Expert Comment

    by:Shahan Ayyub
    This may help you:

    cr.Section2.ReportObjects["ORderNo1"].Height = 600;     // Change Height
    cr.Section2.ReportObjects["ORderNo1"].Left = 600;          // Change Location

    Open in new window


    cr = report bound to ReportViewer
    Section2 = The section holds the field
    ORderNo1 = Name of field exists in section 2

    Author Comment

    Thank you for the response. But may I know where this code should be placed. I have placed the report viewer inside a form. is this code to be placed in the form's code?
    LVL 19

    Accepted Solution

    this code should be placed where you bind report with ReportViewer control. Before binding set location and other parameters and bind it to the control.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
    Via a live example, show how to shrink a transaction log file down to a reasonable size.

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now