Results 1 to 13 of 13

Thread: [Resolved] [2.0] Creating OCX in C# ?

  1. #1
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 02
    Location
    São Paulo, Brazil
    Posts
    263

    Resolved [Resolved] [2.0] Creating OCX in C# ?

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

    Thanks in advance,

    João Luiz
    Last edited by Jlarini; Jul 3rd, 2008 at 09:45 AM.
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

  2. #2
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 01
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    59,467

    Re: [2.0] Creating OCX in C# ?

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (VBA, VB 6, VB.NET, C#)
    Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007

  3. #3

  4. #4
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 01
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    59,467

    Re: [2.0] Creating OCX in C# ?

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (VBA, VB 6, VB.NET, C#)
    Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 05
    Location
    Sydney, Australia
    Posts
    80,868

    Re: [2.0] Creating OCX in C# ?

    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.

  6. #6
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: [2.0] Creating OCX in C# ?

    Allow me to interpret slightly differently.

    http://www.codeproject.com/KB/miscct...incontrol.aspx

    Vague questions are the best.

  7. #7
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 01
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    59,467

    Re: [2.0] Creating OCX in C# ?

    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 ???
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (VBA, VB 6, VB.NET, C#)
    Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007

  8. #8
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 02
    Location
    São Paulo, Brazil
    Posts
    263

    Thumbs up Re: [2.0] Creating OCX in C# ?

    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
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

  9. #9
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: [2.0] Creating OCX in C# ?

    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.

  10. #10
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 01
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    59,467

    Re: [2.0] Creating OCX in C# ?

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (VBA, VB 6, VB.NET, C#)
    Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007

  11. #11
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 02
    Location
    São Paulo, Brazil
    Posts
    263

    Thumbs up Re: [2.0] Creating OCX in C# ?

    Thanks, RobDog888!

    I'll give it a try....

    João Luiz
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

  12. #12
    Junior Member
    Join Date
    Dec 10
    Posts
    28

    Re: [Resolved] [2.0] Creating OCX in C# ?

    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

  13. #13
    New Member
    Join Date
    Sep 12
    Location
    Vancouver, Washington U.S.A.
    Posts
    2

    Re: [Resolved] [2.0] Creating OCX in C# ?

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •