![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Reading a text file with StreamReader I have a tab delimited text file that I open in Excel. While it is open in Excel I need to open and read it from my C# application. I get an access error opening the file with StreamReader or File.Open The error message says that another application has the file open (which of course I already knew). Notepad can open the file while it is open in Excel. Why can't the framework? I've tried specifying the access as read-only, no luck. Any suggestions would be appreciated. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Reading a text file with StreamReader You can try the OleDb http://blogs.msdn.com/gzunino/archiv...02/206377.aspx I have a very basic excel and txt reader here: http://sholliday.spaces.live.com/Blo...842A!176.entry (downloadable code) Or google OleDbReader Excel or OleDbReader txt "km" <km@xxxxxx> wrote in message news:0102F58D-C3A9-45BD-A738-14E2B8BC3BA6@xxxxxx Quote: >I have a tab delimited text file that I open in Excel. > While it is open in Excel I need to open and read it from my C# > application. > I get an access error opening the file with StreamReader or File.Open > The error message says that another application has the file open (which > of > course I already knew). > > Notepad can open the file while it is open in Excel. Why can't the > framework? > > I've tried specifying the access as read-only, no luck. > > Any suggestions would be appreciated. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Reading a text file with StreamReader When I say "try", I mean, I have no idea if it'll work or not. Excel is obviously putting a lock on the file. Check the "Open As" options under Excel, if they exist. "sloan" <sloan@xxxxxx> wrote in message news:eefhPExLJHA.4772@xxxxxx Quote: > You can try the OleDb > > http://blogs.msdn.com/gzunino/archiv...02/206377.aspx > > I have a very basic excel and txt reader here: > http://sholliday.spaces.live.com/Blo...842A!176.entry > (downloadable code) > > Or google > OleDbReader Excel > or > OleDbReader txt > > > "km" <km@xxxxxx> wrote in message > news:0102F58D-C3A9-45BD-A738-14E2B8BC3BA6@xxxxxx Quote: >>I have a tab delimited text file that I open in Excel. >> While it is open in Excel I need to open and read it from my C# >> application. >> I get an access error opening the file with StreamReader or File.Open >> The error message says that another application has the file open (which >> of >> course I already knew). >> >> Notepad can open the file while it is open in Excel. Why can't the >> framework? >> >> I've tried specifying the access as read-only, no luck. >> >> Any suggestions would be appreciated. > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Reading a text file with StreamReader in news:0102F58D-C3A9-45BD-A738-14E2B8BC3BA6@xxxxxx, km wrote : Quote: > I have a tab delimited text file that I open in Excel. > While it is open in Excel I need to open and read it from my C# > application. I get an access error opening the file with StreamReader > or File.Open constructor ? Many options exist when creating a FileStream. In this way I don't get your error. -- Fred foleide@xxxxxx |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Reading A Text File | VB Script | |||
| Reading text file at a URL | VB Script | |||
| Reading file names and Searching for text | VB Script | |||
| Refresh on Reading more than one variable from a Text file | VB Script | |||
| Reading text file and charting them via powergadget | PowerShell | |||