Solved

Resize form with multiple multiline textboxes

Posted on 2009-04-08
5
1,175 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
5 Comments
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
Comment Utility
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 69

Expert Comment

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

Expert Comment

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

Accepted Solution

by:
Mike Tomlinson earned 125 total points
Comment Utility
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
Comment Utility
Your solution was elegant and perfect for my needs.  Great job.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now