Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Resize form with multiple multiline textboxes

Posted on 2009-04-08
5
Medium Priority
?
1,191 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 48

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 48

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

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.

Question has a verified solution.

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

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

926 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