Hi, there!
I what to know if it's possible to create an OCX in C#, and if it's possible, what's the way ?
I have no clue... :blush: :cry:
Thanks in advance,
João Luiz
Printable View
Hi, there!
I what to know if it's possible to create an OCX in C#, and if it's possible, what's the way ?
I have no clue... :blush: :cry:
Thanks in advance,
João Luiz
AFAIK, you can not create ocx controls in .NET. You would need to use Visual Basic 6.0 to create an ocx. In .NET your equilivalent would be a .NET user control of dll file entension that will only natively work in a .NET project.
Well thats not really an ActiveX ocx control but an exposed .NET dll control that registers and unregisters etc. to simulate an ocx but if it helps it help.
I guess to be specific an OCX is an ActiveX control and ActiveX is inherently a COM technology. .NET and COM are mutually exclusive. When using COM components, like ActiveX controls, in .NET apps you have to wrap them in managed code. Your app talks to the managed wrapper and it handles the curly job of actually interacting with the COM component. To it feels like you're using the COM component directly but you're actually using a .NET likely that uses the COM component. That's what the Interop DLLs are that you have to distribute with your app when you use COM components.
The other way is similar. You can't create COM components, like ActiveX controls, in .NET languages. What you can do is create .NET components that, through some jiggery-pokery, appear to be COM components to COM applications.
Rob, I know you know all this already but I'm just clarifying for the populous.
Allow me to interpret slightly differently.
http://www.codeproject.com/KB/miscct...incontrol.aspx
Vague questions are the best.
Another way to look at it is "Why create or simulate an ocx in .NET" when you can create a user control in .NET for use in either .NET or expose the COM and use in any other language?
Bottom line, where are you going to be using the desired "ocx" control? .NET or VB 6 or ???
Thanx for the answers guys!
RobDog888,
Answering your question, I would use it with VB6...
I have an .OCX created in VB6 which is in use right now, but we are migrating the system to C# and, in a first moment, we thought to make this .OCX (in C#) to interact with the current app's version, to make it faster, until we migrate all the system...
As this .OCX has some forms, it's problematic to create a .dll, and, I read somewhere, that's not possible to put forms into a .Dll...
Well, I'm making a revision on the current OCX version to make it faster...
Thanks,
João Luiz
You can still use COM/ActiveX components in .NET. Add a new component to your toolbox, then browse to your existing (and registered) COM component.
In that case you may want to look into the Forms Interop Toolkit.
http://msdn.microsoft.com/en-us/vbasic/bb419144.aspx
It allows you to use .NET forms and controls in a VB 6 program.
Thanks, RobDog888!
I'll give it a try....
João Luiz
Hello Jlarini,
Did you sove your issue?
I'm having a same issue with little different.
we are not migrating code from vb6.0 to C#.net.
Actually My Requirement is, I have a spreadsheet control. I want add an Image over a spreadsheet NOT in a CELL. I can't find any solution in vb6.0 so I choose below idea,
I need to use C# farpoint third party control in vb6.0. reason, in c# Farpoint spread have a method of shapes. We can add image and edit image over the spreadsheet not in cell. but this property don't have shapes or add image over spreadsheet in VB. So, I would like to create OCX in C# and use in VB6.0.
Can you give me any idea? Can you give me some code help.
Thanks,
thenndral
I know this is an older post so this may even be harder to answer since it's almost 2013. But for those of us who still develop in MS Access and other OCX environments... how is it that we are susposed to create our own ActiveX controls these days? Do I have to go out and try and find an old version of VB6? Their has to be an I.D.E. somewhere that is capable of outputting real OCX ActiveX Controls... I hope anyway?
Their has to be... I mean MS Access 2010 still uses OCX right? Or did they switch to the new .Net control? If they did switch in which year... 2007?
Any and all responses would be appreciated... I posted on another forum and no one seemed to have an answer to these questions... Everyone seems to know that you cant create real OCX controls with .Net... but no one seems to provide a solution as to how you create them these days.
thanx