Solved

Resize form -> Adjust TextBox

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

733 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