Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

I am working in windows form c# application.I have a requirement that i need to create a new event for ActiveX control programatically using c#.Is there any way to create a new event for a control using c#.If so Please provide me some solution.






Thanks
Sathish.S
Posted
Comments
[no name] 16-Apr-14 8:53am    
A new event in the control itself? Or an event for the control in your application? What control? What have you tried? What is the problem with what you have tried?
Member 10391350 16-Apr-14 9:22am    
A new event to the control itself.I am stuck up with whether its possible or not,I dont know how to proceed.
[no name] 16-Apr-14 9:33am    
If you have the source, add a new event like normal. If you don't then I would imagine that it's not possible.
Sergey Alexandrovich Kryukov 16-Apr-14 12:58pm    
I actually tried to answer, Solution 1.
—SA

1 solution

Usually "create… programmatically" means that your code creates something during runtime, otherwise "create an event" would mean "create a new (or updated) code with added event member". Event is a member of some control type (or any other type), you cannot add it "programmatically". Just forget it. Instead, start learning some programming and try to understand what different phases of code lifetime to; what compilation does, what happens during loading, how JIT compilation works, what else happens during runtime&hllip[;

A very remote possibility though: using System.Reflection.Emit you can create a whole new assembly during runtime, with any thinkable types and members of those types. But it has nothing to do with ActiveX components. In .NET, ActiveX can be useful only for reusing of some legacy code. If there is some need for upgrading legacy code, creation of the pure .NET components without any COM or ActiveX would be much better.

The whole question simply makes no sense.

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900