I've had a look at the code for grahams example and by the looks of it it's just missing some commas.
try this
Code:Private Type CtrlProportions HeightProportions As Single WidthProportions As Single TopProportions As Single LeftProportions As Single End Type Dim ProportionsArray() As CtrlProportions Sub InitResizeArray() On Error Resume Next Dim I As Integer ReDim ProportionsArray(0 To Controls.Count - 1) For I = 0 To Controls.Count - 1 With ProportionsArray(I) .HeightProportions = Controls(I).Height / ScaleHeight .WidthProportions = Controls(I).Width / ScaleWidth .TopProportions = Controls(I).Top / ScaleHeight .LeftProportions = Controls(I).Left / ScaleWidth End With Next I End Sub Sub ResizeControls() On Error Resume Next Dim I As Integer For I = 0 To Controls.Count - 1 With ProportionsArray(I) ' move and resize controls Controls(I).Move .LeftProportions * ScaleWidth, _ .TopProportions * ScaleHeight, _ .HeightProportions * ScaleHeight, _ .WidthProportions * ScaleWidth End With Next I End Sub 'Form initialize event Private Sub Form_Initialize() InitResizeArray End Sub 'Form resize event Sub Form_Resize() ResizeControls End Sub
there's an on error resume next statement in there which is to trap the errors presented by controls such as timers which have no height and width proportions if you run the original code without it you should get an argument not optional error but the on error resume next tells vb to run straight on ignoring it so it does nothing.
What the code does is remembers where all your controls are when you load the form and then when the form is resized it moves and resizes the controls to keep them in the same proportions as before.
this should solve the textbox problem quite nicely




Reply With Quote