Solved

Resize form with multiple multiline textboxes

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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
Course of the Month10 days, 4 hours left to enroll

624 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