is there any one who solve my problem. basically i want some alignment, i want some spaces in my data.
ROAMERyep. instead of spaces, use the non-breaking space character. as you probably know, browsers ignore whitespace more than one character's worth.
the escaped code is for nonbreaking space is so it's something like
inputstring = inputstring.Replace(" ", " ")
actualy i m saving name n address in the database useing concatenation. my aim is to place some extra spaces between name n address values. the suggestion u have post is not workin well. below is my code, could u tell me where to edit it to produce the desired result.
strVar = t1.Text.PadRight(10, " ") & t2.Text
i want the resulst like Martin Texas there must be 10 white spaces between name n address.
waiting for ur reply.
kamz
another thing you could try is to use is the single char version. i think it's unicode-8 charset #160, not necessarily extended ASCII-i am not expert on character sets, but this works for me. i have a constant that i can use anywhere:
PublicShared NoBreakSpacePaddingCharacterAsChar = Convert.ToChar(160)
otherwise, i feel you most certainly need some type of delimeter to spec out the columns. Consider that your data storage should be decoupled from your presentation of that data.
try the 160 character and let me know (you may need to convert it to string for the padding function (util.NoBreakSpacePaddingCharacter.ToString())
i have some other ideas-i run into this all the time b/c i am working on a legacy system and they use 1 column for multiple entities too.
Hi thomes!
thanx for the reply, as u say u have other methods to tackle this kind of situation. can u plz send me a simple idaea how to fetch data as i need him into my listbox. the single line code that i have posted previously stores the info as i want it. but when i fetch the data into listbox it shows only a single space between name n address. but when i bind the data with textbox control it show me the data as it is stored in the database exaclty the result that i want, e.g name 10 spaces address.
plz reply me with simple hints.
thanx for ur help.
kamz
i am binding to custom objects, so in my object I bind the DataTextField to a property 'Description', which looks like this (Formatting is a custom class and it has a public property called 'NoBreakSpacePaddingCharacter as I explained in an earlier post).
PublicReadOnlyProperty Description()AsString
Get
Dim formattedCompanySubAsString =String.Empty
If m_CompanyNumber <>String.EmptyThen formattedCompanySub =Me.CompanyNumber + "-" +Me.CompanySub
ReturnMe.Number.PadRight(11, Formatting.NoBreakSpacePaddingCharacter) + "orig: " +Me.m_OriginalAmount.ToString("C") + " rem: " +Me.RemainingAmount.ToString("C") + Formatting.NoBreakSpacePaddingCharacter + Formatting.NoBreakSpacePaddingCharacter +Me.Payee + " " +Me.InvoiceNumber + " " + formattedCompanySub
EndGet
EndProperty
But for simplest case, as long as you store the padding spaces in the database, you can replace spaces with non-breaking spaces like this:
stVar = yourNameAndAddressFromDataBase.Replace(" ", Convert.ToChar(160))
It's just the browser not honoring whitespace.
Hi thomes!
thanx for ur help, it's work well. espacially the alst part of the code.
thanx for ur help.
kamz
0 comments:
Post a Comment