Popular Articles
Last viewed:
- Global.asax Events in IIS 6 and IIS 7 for Static Resources
- Format a DateTime as a Facebook-style date with Months, Days, Hours, Minutes Ago
- C# Download File with Progress Bar
- Using a Remote Terminal Licensing Server
- Fix for Firefox click() event issue
- Clustered Index vs. Non-Clustered Index in SQL Server
Recent comments
- Awsome!!
7 hours 9 min ago - C# insert image
22 hours 2 min ago - jkll
3 days 10 hours ago - Thank You
4 days 9 hours ago - Another approach
6 days 11 hours ago - Issue
1 week 29 min ago - thanks
1 week 11 hours ago - Calendar date time
1 week 17 hours ago - Nice Explanation
1 week 20 hours ago - ramya
1 week 3 days ago

Streaming a large file from the hard drive
This code above is interested in only downloading a file from the web. To read in a large file from your hard drive such as a very large XML file, probably the best way to do this is using the FileStream object. You can find out more about it here:
http://msdn.microsoft.com/en-us/library/system.io.filestream.aspx
This will allow you to stream the file in one character at a time. Inside your loop that reads the file, you can update your progress bar and update your TreeView control.
NOTE: Make sure you are doing all of this streaming on a separate thread such as a background worker process. That way, your UI will update. If you run this streaming on your main thread, you will not see the progress bar or any other UI update and it will appear to "hang" until your file is completely streamed in.