: Is there a way to line these up or a more efficient way of displaying the
: fleet other than using a listbox?
Use a listview control (ms common controls set) similar to the files listing
in explorer. Set the control's view property to report, add the four
columnheaders, and add the item data / subitems ...
dim itmx as listitem
set itmx = listview1.listitems.add (,, sCarRegistration)
itmx.subitems(1) = sCarType
itmx.subitems(2) = sCarClass
itmx.subitems(3) = sAvailable
You can even change the icons for each one based on some parameter, perhaps
a red car for 'on hire' and a green car for 'available'. To do this add an
imagelist to the form, add the 16x16 icons, and use as required. This can be
done either during the load ...
set itmx = listview1.listitems.add (,, sCarRegistration, ,
ndxOfCarHiredIcon )
set itmx = listview1.listitems.add (,, sCarRegistration, ,
ndxOfCarAvailableIcon )
.... or later ...
itmx.SmallIcon = ndxOfCarAvailableIcon
You can then add code to sort the listview based on a specific column ...
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As
MSComctlLib.ColumnHeader)
With ListView1
.SortKey = ColumnHeader.Index - 1
.SortOrder = Abs(Not .SortOrder = 1)
.Sorted = True
end with
--
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Roy Riddex" <ro**************@blueyonder.co.uk> wrote in message
news:31*****************@news-binary.blueyonder.co.uk...
: I have a text file which holds data for 30 cars in the following way:
:
: CarRegistration CarType CarClass Available
:
: I'm trying to display the full contents of this text file in a list box so
: the user can see the total car fleet, my problem is that I want everything
: to line up. So far what I'm getting is something like:
:
: R296RKV Ford Mondeo Large On Hire
: TUVWXYZ Vauxhall Vectra Large
: Available
:
:
: Thanks in advance for any help.
: Roy
:
: PS. It's a college assignment and the text file is a must have, so I'm
stuck
: with it.
:
: