Working with File Modification Dates
You can create the appearance of columns in a lisbox using the API with
LB_SETTABSTOPS, then use vbTab to separate the elements of the line to align
at the different columns. If a column's width exceeds the tabstop width set
you're still screwed as far as alignment of that line is concerned, so if
this is expected to be the case, perhaps a listview control in report view
would be more appropriate as the data interface. That would provide you the
means to also sort the data by date or any other column added to the
listview.
Here's the basics on creating and using tab stops in a normal list box ...
http://www.mvps.org/vbnet/code/listapi/listboxtabs.htm ... and this helps
design the positions ... http://www.mvps.org/vbnet/code/listapi/cooltabs.htm
--
Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
: Thanks Samuel.
:
: I actually discovered the FileObject.DateLastModified property, which I
got
: to work with a simple text box and command button. However...read on...
:
: I was using a FileList Box to generate the files, but I think what I
really
: need to do is to make a List Box with 2 columns (1st is file name, 2nd is
: last modified date)
: I am trying to populate the list box as such:
:
: NumFiles = File1.ListCount
: For I = 0 to NumFiles -1
: FileName = File1.Path
: List1.AddItem(I) = File1.Path
: Next I
:
: However the lineage for the 2nd column escapes me... do I need to do
: List1.AddItem for the second colum and enclose it in a Do Until loop?
:
: I'm kind of a newbie here, so the answer might be more obvious than I
: realize.
:
: TIA,
: Gary : : :
: "Samuel Hon" <noreply@samuelhon.co.uk> wrote in message : news:c8672b7d.0310271440.76da96ef@posting.google.c om...
: > Hows this?
: >
: >
: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/ : vafctFileDateTime.asp
: >
: > Not sure about the diff colour bit though
: >
: > "Gary Wilkins" <gwilkins@#NOSPAM#vtiboston.com> wrote in message
: news:<bnjtgn$gsb$1@bob.news.rcn.net>...
: > > Hello everybody,
: > >
: > > I am trying to write a basic form that will allow me to choose a local : drive
: > > (local or network-mapped) and display the contents. The basic : supposition is
: > > that I am trying to sort the files on the DirList box to be sorted by : date
: > > Modified, going furthest back and sorting forward.
: > >
: > > As an aside I would like to figure a way to show that files stored that : are
: > > over 30 days since last modified will appear in a different color, say : red,
: > > or whatever.
: > >
: > > I have hit on some elements for DirFile attributes such as ReadOnly or
: > > Archive, but so far the MSDN has been elusive on returning a way to sort : by
: > > date once I select a drive letter.
: > >
: > > Any suggestions? All assistance greatly appreciated!
: > >
: > > Gary
:
:
|