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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Using OCX control in C#

Using OCX control in C#

Scheduled Pinned Locked Moved C#
questioncsharpdesignbusinessarchitecture
4 Posts 4 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.
  • V Offline
    V Offline
    vhassan
    wrote on last edited by
    #1

    Hi, My project has layered architecture. Business logic has separate project and in this project I have to use some registered OCX method. Current situation: In presentation layer I have window forms. It is easy to add OCX control in toolbox and draw it on any form. Object of drawn OCX control can be used for calling its methods. But I don't want to do it in presentation layer. I have following question: Should I manually add reference of OCX in business logic project? If yes then how I can use it in cs files? Please tell me how to call method of OCX without having forms. That means no creation of control at design time. Thanks. Hassan Nisar

    N A 2 Replies Last reply
    0
    • V vhassan

      Hi, My project has layered architecture. Business logic has separate project and in this project I have to use some registered OCX method. Current situation: In presentation layer I have window forms. It is easy to add OCX control in toolbox and draw it on any form. Object of drawn OCX control can be used for calling its methods. But I don't want to do it in presentation layer. I have following question: Should I manually add reference of OCX in business logic project? If yes then how I can use it in cs files? Please tell me how to call method of OCX without having forms. That means no creation of control at design time. Thanks. Hassan Nisar

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      You probably need to create an interface which exposes few methods that acts like facade methods. This methods should eventually call the methods on the control. With this, your business logic project will not be aware of the OCX controls. You can inject this interface instance into your business classes from the presentation layer.

      Best wishes, Navaneeth

      1 Reply Last reply
      0
      • V vhassan

        Hi, My project has layered architecture. Business logic has separate project and in this project I have to use some registered OCX method. Current situation: In presentation layer I have window forms. It is easy to add OCX control in toolbox and draw it on any form. Object of drawn OCX control can be used for calling its methods. But I don't want to do it in presentation layer. I have following question: Should I manually add reference of OCX in business logic project? If yes then how I can use it in cs files? Please tell me how to call method of OCX without having forms. That means no creation of control at design time. Thanks. Hassan Nisar

        A Offline
        A Offline
        Abhinav S
        wrote on last edited by
        #3

        Go through these tutorials. [^]

        There's nothing left in my right brain and nothing right in my left brain.

        A 1 Reply Last reply
        0
        • A Abhinav S

          Go through these tutorials. [^]

          There's nothing left in my right brain and nothing right in my left brain.

          A Offline
          A Offline
          ali kanju2
          wrote on last edited by
          #4

          you can probably do it like this...

          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