Click here to Skip to main content
15,880,608 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Add Button to Tab Title Pin
Yose Antony11-Jul-09 0:30
Yose Antony11-Jul-09 0:30 
QuestionHow are you 2day? Pin
rithaeu30-Jun-09 23:49
rithaeu30-Jun-09 23:49 
AnswerRe: How are you 2day? Pin
Jon_Boy1-Jul-09 1:23
Jon_Boy1-Jul-09 1:23 
AnswerRe: How are you 2day? Pin
Nagy Vilmos1-Jul-09 1:29
professionalNagy Vilmos1-Jul-09 1:29 
AnswerRe: How are you 2day? Pin
Michael Bookatz1-Jul-09 1:33
Michael Bookatz1-Jul-09 1:33 
AnswerRe: How are you 2day? Pin
0x3c01-Jul-09 5:26
0x3c01-Jul-09 5:26 
QuestionGet List of Files Short By Created Time Pin
Anubhava Dimri30-Jun-09 23:15
Anubhava Dimri30-Jun-09 23:15 
AnswerRe: Get List of Files Short By Created Time Pin
Luc Pattyn1-Jul-09 1:19
sitebuilderLuc Pattyn1-Jul-09 1:19 
Hi,

this is a C# example, you can do the same in VB.NET; there are two key factors:

1. using DirectoryInfo.GetFiles() returns an array of FileInfo which holds name and dates for each file;
2. implementing the IComparer interface to tell Array.Sort how exactly it should perform the sort.

public class CPTest_Sort : IComparer<FileInfo> {
	public override void ListDirOrderedByCreationDateTime(string dirname) {
		DirectoryInfo di=new DirectoryInfo(dirname);
		FileInfo[] fis=di.GetFiles();
		Array.Sort(fis, this);
		foreach(FileInfo fi in fis) {
			log(fi.Name.PadRight(30)+fi.CreationTime);
		}
	}

	public int Compare(FileInfo fi1, FileInfo fi2) {
		DateTime dt1=fi1.CreationTime;
		DateTime dt2=fi2.CreationTime;
		if (dt1<<dt2) return -1;
		if (dt1>dt2) return 1;
		return string.Compare(fi1.Name, fi2.Name);
	}
}


Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.

GeneralRe: Get List of Files Short By Created Time Pin
Anubhava Dimri1-Jul-09 18:27
Anubhava Dimri1-Jul-09 18:27 
QuestionError in ADO.Net application Pin
LostMonkey30-Jun-09 23:05
LostMonkey30-Jun-09 23:05 
AnswerRe: Error in ADO.Net application Pin
Luc Pattyn1-Jul-09 0:20
sitebuilderLuc Pattyn1-Jul-09 0:20 
GeneralRe: Error in ADO.Net application Pin
LostMonkey1-Jul-09 4:25
LostMonkey1-Jul-09 4:25 
GeneralRe: Error in ADO.Net application Pin
Luc Pattyn1-Jul-09 4:28
sitebuilderLuc Pattyn1-Jul-09 4:28 
GeneralRe: Error in ADO.Net application Pin
LostMonkey1-Jul-09 4:51
LostMonkey1-Jul-09 4:51 
GeneralRe: Error in ADO.Net application Pin
Luc Pattyn1-Jul-09 4:56
sitebuilderLuc Pattyn1-Jul-09 4:56 
GeneralRe: Error in ADO.Net application Pin
LostMonkey1-Jul-09 5:00
LostMonkey1-Jul-09 5:00 
QuestionConvert Type in Vb.net Pin
hamed200930-Jun-09 22:22
hamed200930-Jun-09 22:22 
AnswerRe: Convert Type in Vb.net Pin
TheMrProgrammer1-Jul-09 1:28
TheMrProgrammer1-Jul-09 1:28 
QuestionDraw a Polygon using Pen Pin
ClueLess Ar*e30-Jun-09 20:59
ClueLess Ar*e30-Jun-09 20:59 
AnswerRe: Draw a Polygon using Pen Pin
Christian Graus30-Jun-09 21:39
protectorChristian Graus30-Jun-09 21:39 
QuestionSet a keyboard hook Pin
TheMrProgrammer30-Jun-09 20:20
TheMrProgrammer30-Jun-09 20:20 
AnswerRe: Set a keyboard hook Pin
TheMrProgrammer1-Jul-09 5:36
TheMrProgrammer1-Jul-09 5:36 
QuestionHow to do a HTTP GET request Pin
fuhaizah30-Jun-09 18:37
fuhaizah30-Jun-09 18:37 
AnswerRe: How to do a HTTP GET request Pin
Christian Graus30-Jun-09 21:41
protectorChristian Graus30-Jun-09 21:41 
QuestionProblem reading CSV file into dataset. Pin
maf66630-Jun-09 11:10
maf66630-Jun-09 11:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.