Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8368685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:26:44+00:00 2026-06-09T13:26:44+00:00

As per the question I have two panels on my form one called leftPanel

  • 0

As per the question I have two panels on my form one called leftPanel and one called rightPanel. These control a two column layout on my form.

I also have collapsing/expanding groupboxes inside these panels and I wish to iterate over each one to refresh the layout causing them to snap up below each other when the sizing changes.

Here is the code I have:

    private void RefreshLayout()
    {
        int rollingTopLeft = grpiAddressDetails.Top + grpiAddressDetails.Height + 10;
        int rollingTopRight = grpiBranding.Top + grpiBranding.Height + 10;
        foreach(Control temp in leftPanel.Controls && rightPanel.Controls)
        {
            if (temp is GroupBox)
            {
                if (!(temp.Name.Contains("grpi")))    // Top group boxes have 'i' as the 4th character in their name.
                {
                    if (temp.Parent == leftPanel)
                    {
                        temp.Top = rollingTopLeft;
                        rollingTopLeft += temp.Height + 10;
                    }
                    else if(temp.Parent == rightPanel)
                    {
                        temp.Top = rollingTopRight;
                        rollingTopRight += temp.Height + 10;
                    }
                }
            }
        }
    }

This is the line where I need to join the collections:

foreach(Control temp in leftPanel.Controls && rightPanel.Controls)

I realise that && does not work, have also tried Controls.Concat but Control Collections do not seem to have this function.
Hope everything is clear!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:26:45+00:00Added an answer on June 9, 2026 at 1:26 pm
    var allControls = leftPanel.Controls.Cast<Control>().Concat(rightPanel.Controls.Cast<Control>());
    foreach(Control temp in allControls)
    {
         //...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a survey database with one column for each question and one row
As per question says. Specifically i want the html.beginform() to have the runat=server attribute.
Per a great answer from another question I have begun mounting global resources (css/js/images)
As per the title I have three parts to this question... Is db4o object
Say that I have two html nodes like this: <div class='node a'>one</div> <input class='node
I have the following matching problem: I have two data.frames, one with an observation
I have two sets of data in this form: x | y | z
I have a question about javascript time ranges i have two input boxes, the
I have two folders, in one i have the videos and in the second
This is a tough one! I have two tables tblPeopleAnswers and tblAnswers tblPeopleAnswers PersonID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.