Click here to Skip to main content
15,899,313 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Error eith InteropService.COMException Pin
Simon Gregory3-Jun-03 13:31
Simon Gregory3-Jun-03 13:31 
GeneralRe: Error eith InteropService.COMException Pin
chillspider3-Jun-03 16:48
chillspider3-Jun-03 16:48 
GeneralRe: Error eith InteropService.COMException Pin
Simon Gregory3-Jun-03 21:41
Simon Gregory3-Jun-03 21:41 
GeneralRe: Error eith InteropService.COMException Pin
chillspider3-Jun-03 23:59
chillspider3-Jun-03 23:59 
GeneralRe: Error eith InteropService.COMException Pin
MadsJ1-Jul-03 2:52
MadsJ1-Jul-03 2:52 
Generalexception handling and inheritance Pin
Anonymous2-Jun-03 6:53
Anonymous2-Jun-03 6:53 
GeneralRe: exception handling and inheritance Pin
John Kuhn3-Jun-03 14:17
John Kuhn3-Jun-03 14:17 
Generallogical problem Pin
Silhouette1-Jun-03 2:53
Silhouette1-Jun-03 2:53 
I'm developing an application, and one of it functions is to read files.
i want to add a progress bar which indicates how many precents of the file have been read.
the problem is that with big files the program hangs until the operation is completed, and no info is shown in the progress bar.

i'm working with j#.net but it can happen in any language.

here's a bit of the code:

public void readFile(String fileName)
{
FileStream fs =new FileStream(fileName,FileMode.Open);
long fileSize = fs.get_Length();
fs.Close();
StreamReader reader = new StreamReader(fileName);
progressWindow.Show(); //the form where the progress bar is.
int bytesRead = 0; //number of bytes that have been read.
char buf = '\0'; //buffer
while (reader.Peek() != -1) //while not at the end of the file...
{
buf = (char)(reader.Read());
/*...*/
bytesRead++;
//update the progress bar:
progressWindow.progressBar.set_Value((int)((bytesRead/fileSize)*100));
}
reader.Close();
writer.Close();
progressWindow.Hide();
}


thanks for your help.

GeneralRe: logical problem Pin
apferreira3-Jun-03 1:24
apferreira3-Jun-03 1:24 
GeneralSession problems Pin
Peter Kiss30-May-03 2:18
Peter Kiss30-May-03 2:18 
QuestionHow to change app.config file name? Pin
nguyentuancuong28-May-03 22:40
nguyentuancuong28-May-03 22:40 
AnswerRe: How to change app.config file name? Pin
Simon Gregory3-Jun-03 13:28
Simon Gregory3-Jun-03 13:28 
GeneralDeploying a WinForm application Pin
ralfoide28-May-03 14:08
ralfoide28-May-03 14:08 
GeneralRe: Deploying a WinForm application Pin
apferreira28-May-03 23:39
apferreira28-May-03 23:39 
GeneralRe: Deploying a WinForm application Pin
ralfoide29-May-03 18:00
ralfoide29-May-03 18:00 
GeneralMigrating VC++6 Dialog classes Pin
Phil C28-May-03 9:44
Phil C28-May-03 9:44 
GeneralRe: Migrating VC++6 Dialog classes Pin
ralfoide28-May-03 11:12
ralfoide28-May-03 11:12 
GeneralRe: Migrating VC++6 Dialog classes - nope Pin
Phil C28-May-03 14:50
Phil C28-May-03 14:50 
GeneralCPU use of process Pin
MadsJ27-May-03 21:02
MadsJ27-May-03 21:02 
GeneralRe: CPU use of process Pin
Jason McBurney3-Jun-03 8:29
Jason McBurney3-Jun-03 8:29 
GeneralEvent/Delegate Emit and Reflection Pin
Eric Astor27-May-03 14:45
Eric Astor27-May-03 14:45 
GeneralRe: Event/Delegate Emit and Reflection Pin
Marc Clifton27-May-03 14:55
mvaMarc Clifton27-May-03 14:55 
GeneralRe: Event/Delegate Emit and Reflection Pin
Eric Astor27-May-03 15:34
Eric Astor27-May-03 15:34 
GeneralRe: Event/Delegate Emit and Reflection Pin
Marc Clifton27-May-03 15:42
mvaMarc Clifton27-May-03 15:42 
GeneralRe: Event/Delegate Emit and Reflection Pin
Eric Astor28-May-03 0:36
Eric Astor28-May-03 0:36 

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.