Results 1 to 4 of 4

Thread: textwidth

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    textwidth

    hi there,

    i have a form containing label controls, then i am saving its width and caption in an .ini file, then i have a Report Designer which has also a label control in which the caption of the label control will be passed, how would i know how many characters can i placed in the label control in my report designer. i was trying to use the textwidth method but it seems it's not returning the correct width..
    thanks


    alexis23

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: textwidth

    find out the text length...

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: textwidth

    textwidth can only return the width of a string, you can't determine the availible textwidth
    VB Code:
    1. If textwidth("this is a test") > Label1.width then ' too wide for label
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: textwidth

    MSDN: "Returns the width of a text string as it would be printed in the current font."

    Just in case

    VB Code:
    1. Me.Font = Label1.Font

Posting Permissions

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



Click Here to Expand Forum to Full Width