Home All Groups Group Topic Archive Search About

String With fixed Length

Author
3 Apr 2005 9:42 AM
Agnes
i use myreader to get the data, and I want to display in the listbox .
myReader.item("productname) & " - " & myReader.item("color")
Some product name got 15 chars , some is 25 chars.
How can I display it in fixed lenght. e.g 30 chars ?
I want my data display like
TOYS                RED
TELEPPHONE  BLUE
.......                    RED
^^^^^^^^^^^^^^^^
FIXED COLUMN.
I CANNOT USE DATAGRID, BECUASE, i NEED TO SELECT FROM 5 different tables.
That's why I use Listbox.
thanks  a  lot.

Author
3 Apr 2005 10:16 AM
Ken Tucker [MVP]
Hi,

        I think a listview with it view set to details would be a better
choice because it has columns.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconaddingcolumnheaders.asp


Ken
-------------------
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:OZlFIHDOFHA.3988@tk2msftngp13.phx.gbl...
i use myreader to get the data, and I want to display in the listbox .
myReader.item("productname) & " - " & myReader.item("color")
Some product name got 15 chars , some is 25 chars.
How can I display it in fixed lenght. e.g 30 chars ?
I want my data display like
TOYS                RED
TELEPPHONE  BLUE
.......                    RED
^^^^^^^^^^^^^^^^
FIXED COLUMN.
I CANNOT USE DATAGRID, BECUASE, i NEED TO SELECT FROM 5 different tables.
That's why I use Listbox.
thanks  a  lot.
Author
3 Apr 2005 3:45 PM
J L
Won't the padright function do this for you?

John

Show quoteHide quote
On Sun, 3 Apr 2005 17:42:46 +0800, "Agnes" <ag***@dynamictech.com.hk>
wrote:

>i use myreader to get the data, and I want to display in the listbox .
>myReader.item("productname) & " - " & myReader.item("color")
>Some product name got 15 chars , some is 25 chars.
>How can I display it in fixed lenght. e.g 30 chars ?
>I want my data display like
>TOYS                RED
>TELEPPHONE  BLUE
>......                    RED
>^^^^^^^^^^^^^^^^
>FIXED COLUMN.
>I CANNOT USE DATAGRID, BECUASE, i NEED TO SELECT FROM 5 different tables.
>That's why I use Listbox.
>thanks  a  lot.
>