List Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Guys,

I need to append space in front of Directory names inside listbox based on
the folder level inside directory.

If i do
lBoxLocation.Items.Add(new ListItem(" "+
dirInfo.Name,dirInfo(i).FullName))

it adds in front of value. If i put white space, it dont appear at all.

Can someone tell me or guide me to an example which shows how to work with
this?

Thanks

Manny
 
Try running your string through an HtmlDecode:

dim spaces as string = DecodedSpaces(2)
lBoxLocation.Items.Add(spaces + dirInfo.Name,dirInfo(i).FullName)


public shared function DecodedSpaces(numberOfSpaces as integer) as string
dim spaces as string = ""
for i as integer = 0 to numberofSpaces - 1
spaces &= " "
next
return HttpUtility.HtmlDecode(spaces)
end function

Karl
 
Manny Chohan said:
I need to append space in front of Directory names inside listbox based on : :
it adds in front of value. If i put white space, it dont appear at all.

Manny,

Whitespace will be normalized by the browser, so no matter how many consecutive
spaces you send they'll appear as only one on the user's screen.

What you need to do is prepend non-breaking spaces,  , which the browser
won't force normalization of, e.g.,

lBoxLocation.Items.Add(new ListItem("    " + _
dirInfo.Name,dirInfo(i).FullName))

Each   will take up one space when seen in the browser by the user.


Derek Harmon
 
Back
Top