Solved

Stacking Labels in Vb

Posted on 2006-06-15
5
213 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
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 500 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now