How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Pete Your Own Question
Pete, Computer Engineer
Category: Programming
Satisfied Customers: 17930
Experience:  Over 16 years of experience in computer programming.
Type Your Programming Question Here...
Pete is online now
A new question is answered every 9 seconds

I am working in C# ***** I am trying to put in order a list,

Customer Question

I am working in C# ***** I am trying to put in order a list, from the datagridview, by the second column. This is on a web form and the information is being read from a .txt file. i am using VS 2010.
Submitted: 2 years ago.
Category: Programming
Expert:  Pete replied 2 years ago.
I am Pete, and I'll be happy to assist with your question today.
There are lots of options, depending on how the columns are sorted in the .txt file, what type of data you are trying to sort (text, date, etc), and so on.
Something like this should work for you:
string inFile = @"C:\someInFile.txt"
string outFile = @"C:\someOutFile.txt"
var contents = File.ReadAllLines(inFile);
File.WriteAllLines(outFile, contents)