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. Accessing controls of one form from another form

Accessing controls of one form from another form

Scheduled Pinned Locked Moved C#
question
5 Posts 2 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.
  • M Offline
    M Offline
    Mazdak
    wrote on last edited by
    #1

    I have a buuton in my form,when I press this button,another form is open.How can I access controls in first form from second form? Mazy "And the carpet needs a haircut, and the spotlight looks like a prison break And the telephone's out of cigarettes, and the balcony is on the make And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits

    Z 1 Reply Last reply
    0
    • M Mazdak

      I have a buuton in my form,when I press this button,another form is open.How can I access controls in first form from second form? Mazy "And the carpet needs a haircut, and the spotlight looks like a prison break And the telephone's out of cigarettes, and the balcony is on the make And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits

      Z Offline
      Z Offline
      Zeke Le
      wrote on last edited by
      #2

      You can access controls in the first form if their modifiers value are set to public  No time to breathe

      M 1 Reply Last reply
      0
      • Z Zeke Le

        You can access controls in the first form if their modifiers value are set to public  No time to breathe

        M Offline
        M Offline
        Mazdak
        wrote on last edited by
        #3

        Really?!!!!!!!!!!!!!!!!!!!!!!!Thats my question.How?!!!!!!!!!I want to do it from second(child) one after it is shown. Mazy "And the carpet needs a haircut, and the spotlight looks like a prison break And the telephone's out of cigarettes, and the balcony is on the make And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits

        Z 1 Reply Last reply
        0
        • M Mazdak

          Really?!!!!!!!!!!!!!!!!!!!!!!!Thats my question.How?!!!!!!!!!I want to do it from second(child) one after it is shown. Mazy "And the carpet needs a haircut, and the spotlight looks like a prison break And the telephone's out of cigarettes, and the balcony is on the make And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits

          Z Offline
          Z Offline
          Zeke Le
          wrote on last edited by
          #4

          I'm sorry, my mistakes, I thought u wanna do it from the first form. But I found a way that u can try, u can access the parent form's controls this way: Form.ActiveForm.TopLevelControl.Controls[index]  No time to breathe

          M 1 Reply Last reply
          0
          • Z Zeke Le

            I'm sorry, my mistakes, I thought u wanna do it from the first form. But I found a way that u can try, u can access the parent form's controls this way: Form.ActiveForm.TopLevelControl.Controls[index]  No time to breathe

            M Offline
            M Offline
            Mazdak
            wrote on last edited by
            #5

            Thanks for your help :) but this return the control from second form,not parent form. :( Mazy "And the carpet needs a haircut, and the spotlight looks like a prison break And the telephone's out of cigarettes, and the balcony is on the make And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits

            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