Solved

Resize form -> Adjust TextBox

Posted on 1998-09-24
3
399 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
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 20 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
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…

707 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

18 Experts available now in Live!

Get 1:1 Help Now