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. C#
  4. constructor

constructor

Scheduled Pinned Locked Moved C#
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.
  • A Offline
    A Offline
    altafmohd
    wrote on last edited by
    #1

    sir actualy i am passing one form reference in constructor to use its control in another form but i am not getting the control of first form in second form ....... please provide some solution

    J P D 3 Replies Last reply
    0
    • A altafmohd

      sir actualy i am passing one form reference in constructor to use its control in another form but i am not getting the control of first form in second form ....... please provide some solution

      J Offline
      J Offline
      JF2015
      wrote on last edited by
      #2

      Although it is hard to guess without seeing your code, I think that the most probale reason is, that the control in question is private. So, to access the control from the second form, just set the control to public or provide public accessor in the first form.

      1 Reply Last reply
      0
      • A altafmohd

        sir actualy i am passing one form reference in constructor to use its control in another form but i am not getting the control of first form in second form ....... please provide some solution

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        That doesn't sound like a good way to do it. You likely want the second form to have an event and have the first form register a handler for that event.

        1 Reply Last reply
        0
        • A altafmohd

          sir actualy i am passing one form reference in constructor to use its control in another form but i am not getting the control of first form in second form ....... please provide some solution

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          See my article on events here[^] for a better method than constructor injection, in particular the section "Form Communication Using Events".

          Dave
          Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

          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