?
Solved

Resize form with multiple multiline textboxes

Posted on 2009-04-08
5
Medium Priority
?
1,189 Views
Last Modified: 2013-12-20
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?
4-8-2009-2-50-24-PM.png
0
Comment
Question by:WyleOP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 24101713
Instead of trying to resize the control via code, use the Anchor property....

    http://msdn.microsoft.com/en-us/library/system.windows.forms.control.anchor.aspx

Wayne
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24102974
even Anchor won't help to resize proportionaly.
0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 24103102
"proportionaly" was the wrong word. It would look silly if it was resized proportionally.
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 24103295
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:
http://msdn.microsoft.com/en-us/library/h21wykkx.aspx

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.


TableLayoutPanel.jpg
TableLayoutPanelRowProperties.jpg
0
 

Author Closing Comment

by:WyleOP
ID: 31568202
Your solution was elegant and perfect for my needs.  Great job.
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question