Results 1 to 4 of 4

Thread: Access Controls Properties From Another Window

  1. #1

    Thread Starter
    Addicted Member jordan23's Avatar
    Join Date
    Dec 2002
    Posts
    166

    Access Controls Properties From Another Window

    I am trying to change a property from one control one a window from another. How would I add data that is in one window to a combobox in another? Thanks.

  2. #2
    Addicted Member
    Join Date
    Jun 2003
    Location
    Birmingham, AL
    Posts
    188
    The easy way would be to have the form have a reference to the other form.

  3. #3

    Thread Starter
    Addicted Member jordan23's Avatar
    Join Date
    Dec 2002
    Posts
    166
    Can you give me an example. I am kind of new to C#

  4. #4
    Addicted Member
    Join Date
    Jun 2003
    Location
    Birmingham, AL
    Posts
    188
    Ok well i will asume you are opening one form from the other.

    Code:
    class form1
    {
        private form2 child;
    
        public form1()
        {
            child = new form2(this);
        }
    }
    
    class form2
    {
        private form1 parent;
    
        public form2(form1 parent)
        {
            this.parent = parent;
        }
    }
    Simply put you could use the child object to access controls on form2 from form1 and the parent object to access controls on form1 from form2.

Posting Permissions

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



Click Here to Expand Forum to Full Width