Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Left and Top properties

Status
Not open for further replies.

monrosal

Programmer
Aug 22, 2000
42
US
This may be a dumb question but how do I write script to populate these properties in a form. I've tried:
me!box.left = "0.1"""
and
me!box.left = 0.1

What am I doing wrong here?

Thanks for your help
 
I'm pretty sure you must use an integer(in the mathematical sense) when setting this property. Durkin
alandurkin@bigpond.com
 
Durkin,

Well ... Sort of.

See the code below. It may show what is going on.

Code:
Private Sub Form_Activate()

    'To Demo Moving a control @ run time
    'Native Screen positions are shown as inches in the properties
    'but are stored Internally as "Twips".  there are 1444 Twips per Inch
    'So it is necessary to do a conversion.

    Const Left1 = 3.1979        'Just for illustration.  Original Position
    Const Left2 = 4.0979        'Just for Illustration.  Desired New Position

    Const Top1 = 1.0104         'Just for illustration.  Original Position
    Const Top2 = 1.1104         'Just for Illustration.  Desired New Position

    Const TwipsPerIn = 1444     'Conversion from "Twips" to Inches


    If (Abs(Me.txtNValues.Top - Top1 * TwipsPerIn) <= 100) Then
        Me.txtNValues.Top = Top2 * TwipsPerIn
        Me.txtNValues.Left = Left2 * TwipsPerIn
     Else
        Me.txtNValues.Top = Top1 * TwipsPerIn
        Me.txtNValues.Left = Left1 * TwipsPerIn
    End If

End Sub

MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top