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. .NET (Core and Framework)
  4. How to implement a Remoting object which uses Activex control

How to implement a Remoting object which uses Activex control

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpcsharpcomsysadmintutorial
2 Posts 2 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.
  • S Offline
    S Offline
    shokisingh
    wrote on last edited by
    #1

    Hi, I have a major problem in .Net Remoting.. I want to implement a ActiveX Control on Server Side but there seems no way out. Here is how i tried to implement it. 1) Created a form which containd the activex control 2) Implemented by a Class object inheriting System.MarshalByRefObject. 3) Created a instance of form in the class, like: public class Class1 : System.MarshalByRefObject { FormControl fc = new FormControl(); } and then tried to call it's member function on constructor. 4) on calling this object , from a server component implementing Remoting, it works fine. 5) but the problem comes now.. On implementing the client, a exception is thrown: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Threading.ThreadStateExc eption: Could not instantiate ActiveX control '11111111-7ba3-1111-9623-1111111 bd0' because the current thread is not in a single-threaded apartment. Please help me out.:confused::confused::confused::confused: Ashok Singh Real Programmer's do not comment their code, if it is hard to write then it should hard to understand

    N 1 Reply Last reply
    0
    • S shokisingh

      Hi, I have a major problem in .Net Remoting.. I want to implement a ActiveX Control on Server Side but there seems no way out. Here is how i tried to implement it. 1) Created a form which containd the activex control 2) Implemented by a Class object inheriting System.MarshalByRefObject. 3) Created a instance of form in the class, like: public class Class1 : System.MarshalByRefObject { FormControl fc = new FormControl(); } and then tried to call it's member function on constructor. 4) on calling this object , from a server component implementing Remoting, it works fine. 5) but the problem comes now.. On implementing the client, a exception is thrown: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Threading.ThreadStateExc eption: Could not instantiate ActiveX control '11111111-7ba3-1111-9623-1111111 bd0' because the current thread is not in a single-threaded apartment. Please help me out.:confused::confused::confused::confused: Ashok Singh Real Programmer's do not comment their code, if it is hard to write then it should hard to understand

      N Offline
      N Offline
      neroknights
      wrote on last edited by
      #2

      Try putting the following attribute in your client app. Remove the [STAThread] and put [MTAThread]. [MTAThread] static void Main() { Application.Run(new Form1()); }

      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