Please help me to convert thisC# Code into VC++.

Discussion in 'C++' started by nnhamane, Jan 30, 2009.

Thread Status:
Not open for further replies.
  1. nnhamane

    nnhamane New Member

    Joined:
    Jun 23, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    //Code
    
    private static void AddExtension(ReportViewer viewer, string name, Type extensionType)
    { 
        const BindingFlags Flags = BindingFlags.NonPublic | 
              BindingFlags.Public | BindingFlags.Instance;
        FieldInfo previewService = 
          viewer.LocalReport.GetType().GetField("m_previewService", Flags);
        MethodInfo ListRenderingExtensions = 
          previewService.FieldType.GetMethod("ListRenderingExtensions", Flags);
        IList extensions = ListRenderingExtensions.Invoke(
          previewService.GetValue(viewer.LocalReport), null) as IList;
        Type localRenderingExtensionInfoType = Type.GetType(
            "Microsoft.Reporting.LocalRenderingExtensionInfo, " + 
            "Microsoft.ReportViewer.Common," +
            "Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
        ConstructorInfo ctor = localRenderingExtensionInfoType.GetConstructor(
            Flags, null, new Type[] { typeof(string), typeof(string), 
            typeof(bool), typeof(Type), typeof(bool) }, null); 
        object instance = 
          ctor.Invoke(new object[] { name, name, true, extensionType, true }); 
        extensions.Add(instance);
    }
    //End Of Code
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,335
    Likes Received:
    377
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice