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 8370015
In Process

The Archive Base Latest Questions

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

How can I arrange controls in my parent form by code ? So far

  • 0

How can I arrange controls in my parent form by code?

So far I call the user controls with this code;

 Me.ParentForm.Controls.Remove(Me)
 controlMain()

I want the user controls arrange itself whenever the user resize the parent form or maximize the form. Currently, I set the controls by,

    Public Sub controlMain()
        Dim usrctl As New _ctlMain
        _Main.Controls.Add(usrctl)
        usrctl.Location = New Point(_Main.Width / 2 - usrctl.Width / 2, _Main.Height / 2 -usrctl.Height / 2)
    End Sub

which is on a module. _Main is my parent form while _ctlMain is the control being called. I do not intend to put the user control on the parent form during design because I have other user controls to call after a specific function in an active control is called.

I have tried the autosize property of usercontrol but I guess it doesn’t work on my application. Usercontrol doesn’t have the dock and anchor properties.

  • 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:48:26+00:00Added an answer on June 9, 2026 at 1:48 pm

    Use one of the automatic layout controls, like a FlowLayoutPanel or a TableLayoutPanel.

    Instead of adding your user controls to the form itself, add them to either a FlowLayoutPanel or TableLayoutPanel control that has been placed on top of the form using DockStyle.Fill.

    It sounds to me like a FlowLayoutPanel is what you want. With that, the layout of the controls is handled entirely automatically, and they are positioned either in left-to-right or top-to-bottom order, depending on the value of the FlowDirection property.

    The only reason to choose a TableLayoutPanel is if you need to have more precise control over the exact positioning of the controls. It works just like an HTML table, with each control getting its own “cell”.

    You can also set the Dock and/or Fill properties of the individual user controls if you’d like to ensure that their sizes are automatically adjusted. For example, you can set each control to fill the entire cell in which it is placed in a TableLayoutPanel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before suggesting bin packing algorithms, they assume you can re-order the elements and arrange
Can someone thoroughly explain the last line of the following code: def myMethod(self): #
I need to create an utility where user can create their own data entry
I'm attempting to write an app that can arrange timed playback of some (mostly
With grid.arrange I can arrange multiple ggplot figures in a grid to achieve a
I have dates currently in this format: yy-mm-dd (e.g. 2011-11-18) I want them in
can any one tell me the details about below displayed control?can i arrange images
in navicat you can arrange the order of the columns but i have yet
So I have this form on a page and trying to validate values with
I have a tree and I can arrange the nodes inside using drag and

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.