Solved

Resize form with multiple multiline textboxes

Posted on 2009-04-08
5
1,183 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)
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 85

Accepted Solution

by:
Mike Tomlinson earned 125 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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

828 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