User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 456,468 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,797 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 5947 | Replies: 12 | Solved
Reply
Join Date: Dec 2005
Posts: 46
Reputation: _r0ckbaer is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 7
_r0ckbaer's Avatar
_r0ckbaer _r0ckbaer is offline Offline
Light Poster

Re: Open Text File And Sort

  #11  
Sep 25th, 2007
When you catch the exception you should output its message, and not "blabla..is not a valid image file". That way you'll be able to identify what's going wrong.
Reply With Quote  
Join Date: Sep 2007
Posts: 9
Reputation: nullified is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
nullified nullified is offline Offline
Newbie Poster

Re: Open Text File And Sort

  #12  
Sep 25th, 2007
I identified the debugger error....apart from that it is out of my league

but i got it working and it does what i want so i'll quit while im ahead i think

here is a link to the code for future reference....or for anyone thats interested.


http://files.filefront.com/LoginSort.../fileinfo.html
Reply With Quote  
Join Date: Dec 2005
Posts: 46
Reputation: _r0ckbaer is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 7
_r0ckbaer's Avatar
_r0ckbaer _r0ckbaer is offline Offline
Light Poster

Re: Open Text File And Sort

  #13  
Sep 25th, 2007
Just for the gallery, see first part of code in my previous post:


string format = "MM.dd.yyyy HH:mm:ss";
lines.Sort(new Comparison<string>(delegate(string a, string b)
{
string dateA = Regex.Match(a, "\\[(.+)\\]").Groups[1].Value;
string dateB = Regex.Match(b, "\\[(.+)\\]").Groups[1].Value;

return (DateTime.Compare(DateTime.ParseExact(dateA, format, null),
DateTime.ParseExact(dateB, format, null)));
}));
Last edited by _r0ckbaer : Sep 25th, 2007 at 7:41 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C# Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 2:23 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC