Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2003
    Posts
    21

    Unanswered: setting label/textbox lengths ?

    OK guys/gals I'm a VB guy. BUT I have a an access application (VBA) that has some labels and textboxes. OK, this may sound like a stupid question, but when I look at a label's properties in access, is says that the left, width, top, etc is: 1.0067"

    which means 1.0067 inches, right? OK, my question is, how can I say (in code) label1.left = 1.0067"?

    Basically, I'm changing the label's caption, and size(s) etc, at runtime, so I want to set the left/width/etc. So, how do I set it as inches/pixels/twips etc?

    Am I making sense?

    TIA!

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You can make a Global constant
    Global Const CM_TWIP = 567 ' 1 cm has 567 Twip


    then in yur code you can use it like this

    text1.width= 5 * CM_TWIP ' you get 5 cm width TextBox

    the same, you can make with inches, ...etc

  3. #3
    Join Date
    Jul 2003
    Posts
    21
    Originally posted by hammbakka
    You can make a Global constant
    Global Const CM_TWIP = 567 ' 1 cm has 567 Twip


    then in yur code you can use it like this

    text1.width= 5 * CM_TWIP ' you get 5 cm width TextBox

    the same, you can make with inches, ...etc
    Ok, I'm following you, but in VB you can do... Screen.TwipsPerPixel or something like that. But is there some way to make the conversion through code? I mean I have the: 1.095" so can I say:

    label1.left = x * 567 etc???

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Yes you can do like that
    lable1.left= x * 567 ' where x is the required distance from the screen leftside

  5. #5
    Join Date
    Jul 2003
    Posts
    21
    OK, well I guess what I'm asking is how to convert the inches ", of the values that I have, to twips, etc, or whatever...so that the labels/textboxes end up where I want them.

    Basically I totally suck at math and/or don't know how to convert the values so... how can I say:

    label1.left = 1.0234"

    and then say in code (separate VB Prog):

    label1.left = 1 * x
    OR
    label1.left = "1.0234" * Screen.TwipsPerPixel (etc)

    or more easily say label1.left = "1.0234" (which doesn't seem to work).

    Sorry if I'm acting like an idiot...

    I really appreciate your help!

    TIA!

  6. #6
    Join Date
    Jul 2003
    Posts
    21
    Ok, I guess what I was asking is this:
    http://www.pbdr.com/vbtips/gen/convtwip.htm

    How many twips = and inch...

    I should be able to set the left/width/ etc values * 1440

    Thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •