?
Solved

Resize form -> Adjust TextBox

Posted on 1998-09-24
3
Medium Priority
?
407 Views
Last Modified: 2006-11-17

How do I create a form that when the user resize the form the TextBox will adjust to the size of the form ?

Also the buttons in the form must move.
0
Comment
Question by:jfl
[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
3 Comments
 
LVL 3

Expert Comment

by:vmano
ID: 1436532
There are very good Elastic ActiveX controls which will do the same for you from green-tree software. you can check out their site at
http://www.green-tree.com/components_Main_Frame.htm. i think they have 30 day evaluation deal and you can try that.

let me know if this helps,
vmano
0
 

Author Comment

by:jfl
ID: 1436533
I don't have the money for that...Sorry
0
 
LVL 4

Accepted Solution

by:
trkcorp earned 80 total points
ID: 1436534
I thought I submitted this answer but I got your rejection of vmano & it wasn't there!!! So, if you already have this forgive me for resubmitting.

Use the Form_Resize event.  The following is an example:

Private Sub Form_Resize()
If Me.WindowState <> 1 Then
  ' TDBGrid1 is a top aligned data grid being resized to fit the
  'form. The bottom of the grid is always 3.5 * the height of the
  'close button from the bottom... (There is also a datacontrol
  'aligned to the bottom of this form.)
  TDBGrid1.Height = Me.Height - (cmdClose.Height * 3.5)
  ' cmdClose is always on the right corner just below the grid
  'and just above the datacontrol...the same distance from the
  'right side of the form.
  cmdClose.Left = Me.Width - 1500
  cmdClose.Top = Me.Height - 1200
  ' cmdFrmDtl is always on the left but its relative horizontal
  'position never changes
  cmdFrmDtl.Top = Me.Height - 1200
  'cmdTree is to be centered on the form and level with the
  'other buttons
  cmdTree.Top = Me.Height - 1200
  cmdTree.Left = (Me.Width / 2) - (cmdTree.Width / 2)
End If
End Sub

First, Make sure the window is not being minimized as you will get an error moving things around on minimized forms.
vbNormal      0      (Default) Normal.
VbMinimized      1      Minimized (minimized to an icon)
VbMaximized      2      Maximized (enlarged to maximum size)

Adjust your controls proportionately to the form's Width & Height properties (Me refers to the current form)
To adjust the a text box width as you need just do something like this:
text1.width = Me.Width - 150
Where you have 75 of border on the left and 75 of border on the right... This way you always have a proportionate box.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

762 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