Graphics

 View Only
  • 1.  Get Textfield width in VB.net

    Posted 06-14-2012 12:45
    Hey there people,

    I'm working on a little script in VB.net and I need to know how to get the width from a textfield. The xpTextobject has a function called GetTextWidth but I have to input a string into that function and when I do that it always return a zero. I probably do something wrong...

    So does anyone have an idea how to use this function or is there another way to do this?

    Thanks in advance!


  • 2.  RE: Get Textfield width in VB.net

    Posted 06-14-2012 15:49
    You can use the bounding box property of the text object to get the width of the text..

    Here is an example...

    dim objtxt as xpbaseobject

    dim val as double

    Self.GetObjectByName("field1", objtxt)

    val = objtxt.boundingbox.width

    val will return the width in pixels of the text object

    #XPression


  • 3.  RE: Get Textfield width in VB.net

    Posted 06-15-2012 07:12
    Hey Jim,

    Thanks for the quick response! I'm going to try it as soon as possible!

    Thanks again!

    #XPression