Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How will you convert this C# code into VC++?

How will you convert this C# code into VC++?

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++comquestionannouncement
9 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nilesh Hamane
    wrote on last edited by
    #1

    //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

    http://nnhamane.googlepages.com/

    CPalliniC H D 3 Replies Last reply
    0
    • N Nilesh Hamane

      //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

      http://nnhamane.googlepages.com/

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Please don't convert it: let this bad code remain in the C# world. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      E H 2 Replies Last reply
      0
      • N Nilesh Hamane

        //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

        http://nnhamane.googlepages.com/

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        Can you explain about your request? I think we can help you and its better than convert this code to c++.

        Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

        1 Reply Last reply
        0
        • CPalliniC CPallini

          Please don't convert it: let this bad code remain in the C# world. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          E Offline
          E Offline
          Eytukan
          wrote on last edited by
          #4

          :laugh:


          OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]

          1 Reply Last reply
          0
          • CPalliniC CPallini

            Please don't convert it: let this bad code remain in the C# world. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            You're lucky you didnt say it on the C# world. :-D ;)

            Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

            CPalliniC 1 Reply Last reply
            0
            • H Hamid Taebi

              You're lucky you didnt say it on the C# world. :-D ;)

              Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              There I would say the opposite... :rolleyes: :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              In testa che avete, signor di Ceprano?

              _ 1 Reply Last reply
              0
              • N Nilesh Hamane

                //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

                http://nnhamane.googlepages.com/

                D Offline
                D Offline
                Dave Doknjas
                wrote on last edited by
                #7

                C++/CLI:

                private:
                static void AddExtension(ReportViewer ^viewer, System::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 = dynamic_cast(ListRenderingExtensions->Invoke(previewService->GetValue(viewer->LocalReport), nullptr));
                Type ^localRenderingExtensionInfoType = Type->GetType("Microsoft.Reporting.LocalRenderingExtensionInfo, " + "Microsoft.ReportViewer.Common," + "Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
                ConstructorInfo ^ctor = localRenderingExtensionInfoType->GetConstructor(Flags, nullptr, gcnew array { System::String::typeid, System::String::typeid, bool::typeid, Type::typeid, bool::typeid }, nullptr);
                System::Object ^instance = ctor->Invoke(gcnew array { name, name, true, extensionType, true });
                extensions->Add(instance);
                }

                David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter VB & C# to Java Converter Java to VB & C# Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++

                1 Reply Last reply
                0
                • CPalliniC CPallini

                  There I would say the opposite... :rolleyes: :-D

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  _ Offline
                  _ Offline
                  _Superman_
                  wrote on last edited by
                  #8

                  Consider Politics as a career? :-D

                  «_Superman_»

                  CPalliniC 1 Reply Last reply
                  0
                  • _ _Superman_

                    Consider Politics as a career? :-D

                    «_Superman_»

                    CPalliniC Offline
                    CPalliniC Offline
                    CPallini
                    wrote on last edited by
                    #9

                    Nope, unfortunatey in my Country there are clowns (e.g. Mr. Berlusconi) far better than me. :-D

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    In testa che avete, signor di Ceprano?

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups