|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Width of LabelHi,
An easy on I'm guessing! How do I restrict the length of a label? I have tried setting the width to say 200px but if the user inputs a continuous line of characters it's doesn't wrap. Thanks in advance. Jack The problem you have is not the width attribute of the label control rather
it is the continuous line of characters. You will have to reformat any string that is longer than the maximum length of your label. Here is an example of a function that you pass the string that you wish to space out and the max length of the label that you wish to display: Private Function SpaceOut(ByVal inputstring As String, ByVal len As Integer) As String If inputstring.Length > len Then Return inputstring.Substring(0, len) & " " & SpaceOut(inputstring.Substring(len + 1), len) Else Return inputstring End If End Function So if you have a text in a variable called LongLine that want to display in a label named lblText, you would use it like this: lblText.Text = SpaceOut(LongLine, 30) --- http://www.societopia.net http://www.webswapp.com Show quoteHide quote "jack-e" <jac***@humlog.com> wrote in message news:1118360412.209388.16540@f14g2000cwb.googlegroups.com... > Hi, > > > An easy on I'm guessing! > > > How do I restrict the length of a label? I have tried setting the width > > to say 200px but if the user inputs a continuous line of characters > it's doesn't wrap. > > > Thanks in advance. > > > Jack >
Other interesting topics
Asynchronous Call
<Head>Tag PostBack problem 2.0 App-Code Folder Support for 'Code-Behind' HttpWebRequest.GetResponse on POST returns 405 method not allowed LDAP Query Help Creating a "serverless" app... loading session variables in page title bar adding html to body Cannot use integrated security from a thread in ASP.Net/ Windows 2 |
|||||||||||||||||||||||