473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Sorting FileInfo[] by Date

Hi there,
I have just populated my FileInfo[] array with files from a folder.
Before I display them on a grid, I would like to sort them by Date DESC.

What is the easiest way to do so?

Filippo.
Nov 15 '05 #1
4 12579
cs
make a class that implements IComparer
"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:uU****************@TK2MSFTNGP09.phx.gbl...
Hi there,
I have just populated my FileInfo[] array with files from a folder.
Before I display them on a grid, I would like to sort them by Date DESC.

What is the easiest way to do so?

Filippo.

Nov 15 '05 #2
Never used ICompare before, do you have a sample I can use as start up?

Filippo.
"cs" <[rem]casolorz[rem]@hot[rem]mail.com> wrote in message
news:OT**************@TK2MSFTNGP09.phx.gbl...
make a class that implements IComparer
"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:uU****************@TK2MSFTNGP09.phx.gbl...
Hi there,
I have just populated my FileInfo[] array with files from a folder.
Before I display them on a grid, I would like to sort them by Date DESC.

What is the easiest way to do so?

Filippo.


Nov 15 '05 #3
Just found a sample.
http://aspnet.4guysfromrolla.com/articles/060403-1.aspx
Thanks
F.
"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Never used ICompare before, do you have a sample I can use as start up?

Filippo.
"cs" <[rem]casolorz[rem]@hot[rem]mail.com> wrote in message
news:OT**************@TK2MSFTNGP09.phx.gbl...
make a class that implements IComparer
"Filippo Pandiani" <pa********@hotmail.com> wrote in message
news:uU****************@TK2MSFTNGP09.phx.gbl...
Hi there,
I have just populated my FileInfo[] array with files from a folder.
Before I display them on a grid, I would like to sort them by Date DESC.
What is the easiest way to do so?

Filippo.



Nov 15 '05 #4
Probably the easiest and quickest way is to create a custom IComparer
implementation which compares the dates of the FileInfos, and then pass
this to the oveload of the Array.Sort() method that takes an IComparer.

Greg

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: p0wer | last post by:
Let's suppose I have this sample document: <root> <entry id="1" <date>2003-08-03</date> <param_1>5</param_1> <param_2>10</param_2> </entry> <entry id="2"> ...
7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
22
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b)...
1
by: Amjad | last post by:
I want to sort files in a specified folder by their creation date and then display their names (sorted by the creation date) in a textbox for example. How would you do that? Dim dir As New...
13
by: Randall Arnold | last post by:
I'm not happy with the order in which OpenFileDialog retrieves multiple selected files. I want them in Date order, oldest to newest, but by default they come in by filename, last to first. The...
1
by: Tim Failes | last post by:
This seems a trival question, but I cannot get it to work properly... Essentially my question is, how can I create a text file, and guarantee it is given the current date/time as the Creation Time?...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
3
by: nagmvs | last post by:
Hi to all I have one table with 6 columns and 20 rows.I want to sort each and every column when i click the column name in the table. for sorting i create one more page.when i click the column...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.