Solved

Resize form -> Adjust TextBox

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

864 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

24 Experts available now in Live!

Get 1:1 Help Now