Click here to Skip to main content
15,888,802 members
Home / Discussions / C#
   

C#

 
QuestionHow to copy columns data from one excel file to another excel file using C#. Pin
Member 1194327029-May-16 22:00
Member 1194327029-May-16 22:00 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
Richard MacCutchan29-May-16 22:19
mveRichard MacCutchan29-May-16 22:19 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
OriginalGriff29-May-16 22:27
mveOriginalGriff29-May-16 22:27 
AnswerRe: How to copy columns data from one excel file to another excel file using C#. Pin
Gerry Schmitz30-May-16 5:43
mveGerry Schmitz30-May-16 5:43 
QuestionHow can i retry read current line at text file? Pin
Member 1243103929-May-16 19:01
Member 1243103929-May-16 19:01 
AnswerRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 19:22
mveOriginalGriff29-May-16 19:22 
GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 20:16
Member 1243103929-May-16 20:16 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 20:53
mveOriginalGriff29-May-16 20:53 
Depends on the size. "Big" is a relative term! Laugh | :laugh:
Streaming isn't difficult either:
C#
using (StreamReader read = new StreamReader(@"D:\Temp\MyBigFile.txt"))
    {
    while (read.Peek() >= 0)
        {
        string line = read.ReadLine();
        }
    }

But...unless your file is really, really big - like 250,000,000 lines plus - it's not necessarily going to be much more efficient than reading all the lines at once.
If you have to "go back" to lines, you can use
C#
long pos = read.BaseStream.Position;

before each ReadLine to find out where in the file you are, and use Seek to go back there. But...remember that if you are storing the position of all lines, you can't store more than 250,000,000 on a 64 bit system, and 500,000,000 on a 32 bit system as there is an upper limit to the size of an array in .NET
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 22:10
Member 1243103929-May-16 22:10 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 22:12
mveOriginalGriff29-May-16 22:12 
GeneralRe: How can i retry read current line at text file? Pin
Matt T Heffron31-May-16 8:52
professionalMatt T Heffron31-May-16 8:52 
AnswerRe: How can i retry read current line at text file? Pin
koolprasad200329-May-16 19:30
professionalkoolprasad200329-May-16 19:30 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 20:03
mveOriginalGriff29-May-16 20:03 
GeneralRe: How can i retry read current line at text file? Pin
koolprasad200329-May-16 20:08
professionalkoolprasad200329-May-16 20:08 
GeneralRe: How can i retry read current line at text file? Pin
Member 1243103929-May-16 20:28
Member 1243103929-May-16 20:28 
GeneralRe: How can i retry read current line at text file? Pin
koolprasad200329-May-16 22:56
professionalkoolprasad200329-May-16 22:56 
GeneralRe: How can i retry read current line at text file? Pin
Eddy Vluggen30-May-16 0:25
professionalEddy Vluggen30-May-16 0:25 
GeneralRe: How can i retry read current line at text file? Pin
OriginalGriff29-May-16 20:54
mveOriginalGriff29-May-16 20:54 
SuggestionRe: How can i retry read current line at text file? Pin
Richard Deeming1-Jun-16 1:59
mveRichard Deeming1-Jun-16 1:59 
QuestionGeometry problem with c# .net Pin
avisotorisher29-May-16 0:35
avisotorisher29-May-16 0:35 
AnswerRe: Geometry problem with c# .net Pin
Richard MacCutchan29-May-16 1:08
mveRichard MacCutchan29-May-16 1:08 
GeneralRe: Geometry problem with c# .net Pin
avisotorisher29-May-16 2:05
avisotorisher29-May-16 2:05 
GeneralRe: Geometry problem with c# .net Pin
Richard MacCutchan29-May-16 2:12
mveRichard MacCutchan29-May-16 2:12 
GeneralRe: Geometry problem with c# .net Pin
avisotorisher30-May-16 18:35
avisotorisher30-May-16 18:35 
AnswerRe: Geometry problem with c# .net Pin
Patrice T29-May-16 7:13
mvePatrice T29-May-16 7:13 

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.