Solved

Stacking Labels in Vb

Posted on 2006-06-15
5
218 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 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

734 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