Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Stacking Labels in Vb

Posted on 2006-06-15
5
Medium Priority
?
229 Views
Last Modified: 2010-04-07
Q.  I use Vb to stack long label names in GIS and now need to add more that one field.  Here is the current code:

' Function FindLabel ( [NAME] )
' Stacks a label in multiple lines if
' exceeding a given length.
' Note: Not applicable to line layers.
' ------------------------------------
  dim s, sNew, i, l
  s = [NAME]
  l = Len(s)
  if l > 10 then  ' stack if exceeding this length
    sNew = Left(s,10)
    i = 11  ' scan for blank space starting from this position
    While i <= l
      if Mid(s,i,1) = " " then
        sNew = sNew & VBNewLine
      else
        sNew = sNew & Mid(s,i,1)
      end if
      i = i + 1
    Wend
  else
    sNew = s
  end if

I need to add a field called SITEADDR and limit it's character line the same as NAME.  Any ideas?
0
Comment
Question by:gwr477
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 2000 total points
ID: 16912816

ok, i don't quiet understand the question, but what you want to do can be done way easier:

give the label the width you want to have it max.

now set the property wordwrap of the label to true,
and the property autosize too

so the code looks somthing like this:

Label1.Width = 1575
Label1.WordWrap = True
Label1.AutoSize


you can also do this when designing

0
 
LVL 4

Expert Comment

by:JRCSystems
ID: 17287217
Is this question still open?
I agree with Mark, not quite sure what you're trying to do.
Can you give us some more info please?
0
 

Author Comment

by:gwr477
ID: 17287336
Sorry for not closing this earlier.  Thanks for your expert help.
0
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 17287720

thanks for the points, and happy coding!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question