• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1197
  • Last Modified:

Resize form with multiple multiline textboxes

I have a vb.net form with two multiline textboxes.  When I resize the form, I want both textboxes to resize proportionately.  Right now, I can only get one of the two to do this properly.  I've tried added code to the form_resize event like this:
        Panel2.Height = Panel4.Height
But it doesn't work well on a Maximize.

Any thoughts?
1 Solution
Wayne Taylor (webtubbs)Commented:
Instead of trying to resize the control via code, use the Anchor property....


Éric MoreauSenior .Net ConsultantCommented:
even Anchor won't help to resize proportionaly.
Wayne Taylor (webtubbs)Commented:
"proportionaly" was the wrong word. It would look silly if it was resized proportionally.
Mike TomlinsonMiddle School Assistant TeacherCommented:
If you need to make TWO TextBoxes both grow vertically...but "SPLIT" a certain portion of the form then you need to do it PROGRAMMATICALLY.

That is, unless, you use something like a TableLayoutPanel and make your TextBoxes FILL a Row:

Below are two images, the first of a TableLayoutPanel with 1 column and 4 Rows, and the second of the Row properties.  The entire TableLayoutPanel is Anchored so that it will grow with the form.  The 1st and 3rd rows will stay the same size vertically to simply hold the Labels...but the 2nd and 4ths will SPLIT the remaining vertical space 50/50 in the TableLayoutPanel.

WyleOPAuthor Commented:
Your solution was elegant and perfect for my needs.  Great job.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now