Click here to Skip to main content
15,867,686 members
Home / Discussions / C#
   

C#

 
Questionhow we can display OlItemType (outlook item type ) on windows form controls or user control Pin
govind yadav14-May-06 20:46
govind yadav14-May-06 20:46 
QuestionCrushing on Win 2003 Server Pin
Desgard14-May-06 20:43
Desgard14-May-06 20:43 
AnswerRe: Crushing on Win 2003 Server Pin
WillemM14-May-06 21:21
WillemM14-May-06 21:21 
GeneralRe: Crushing on Win 2003 Server Pin
Desgard14-May-06 22:23
Desgard14-May-06 22:23 
AnswerRe: Crushing on Win 2003 Server Pin
S. Senthil Kumar15-May-06 1:43
S. Senthil Kumar15-May-06 1:43 
QuestionUpdating progress bar after each ReadLine() Pin
mtbchef114-May-06 17:16
mtbchef114-May-06 17:16 
AnswerRe: Updating progress bar after each ReadLine() Pin
S. Senthil Kumar14-May-06 18:18
S. Senthil Kumar14-May-06 18:18 
GeneralRe: Updating progress bar after each ReadLine() Pin
mtbchef114-May-06 20:34
mtbchef114-May-06 20:34 
Hi Senthil:

The deal is I have a Read function that reads the file line by line and returns the contents of the file to a text box in the form. I need to update the form's progress bar (on the UI Thread).

A. the function to increment the progress bar.
1. private void progressBarUpdate()
2. {
3. //Reset to start if required
4. if (this.progbar.Value == this.progbar.Maximum)
5. {
6. this.progbar.Value = this.progbar.Minimum ;
7. }
8. else
9. {
10. this.progbar.PerformStep();
11. }
12. }

B. the delegate
13. private delegate string ReadDelegate(string file);

C. the function that reads the file, line by line.
14. private string Read(string file)
15. {
16. StreamReader reader = new StreamReader(file);

17. string strBufferFormatted = String.Empty;
18. string strLine = String.Empty;
19. int intLines = -1;

20. while(reader.Peek() != -1)
21. {
22. strLine = reader.ReadLine();
23. intLines++;
24. //update the progress bar here
25. BeginInvoke(new MethodInvoker(progressBarUpdate));

26. strBufferFormatted = strBufferFormatted + strLine;
27. }

28. this.lblLinesUnformatted.Text = intLines.ToString() + " lines read.";
29. reader.Close();

30. return strBufferFormatted;
31. }

The form is unresponsive while the file is being read, only after the file is read do the progess bar's blue blocks increment.

What am I missing?
Regards,
Keith




GeneralRe: Updating progress bar after each ReadLine() Pin
S. Senthil Kumar15-May-06 1:41
S. Senthil Kumar15-May-06 1:41 
GeneralRe: Updating progress bar after each ReadLine() Pin
mtbchef115-May-06 20:24
mtbchef115-May-06 20:24 
Questionhow to read usb storage Id or Sn ? Pin
Veelone14-May-06 16:09
Veelone14-May-06 16:09 
Questiondisable TCP-IP, get MAC address Pin
Dave k.a. DPA14-May-06 13:09
Dave k.a. DPA14-May-06 13:09 
Question[EditorAttribute(typeof(MyFileNameEditor), typeof(UITypeEditor))] Pin
Susuko14-May-06 11:06
Susuko14-May-06 11:06 
AnswerRe: [EditorAttribute(typeof(MyFileNameEditor), typeof(UITypeEditor))] Pin
Office Lineman14-May-06 12:53
Office Lineman14-May-06 12:53 
QuestionFlash in taskbar Pin
Martin2314-May-06 10:31
Martin2314-May-06 10:31 
AnswerRe: Flash in taskbar Pin
Stefan Troschuetz14-May-06 10:48
Stefan Troschuetz14-May-06 10:48 
GeneralRe: Flash in taskbar Pin
Martin2314-May-06 11:12
Martin2314-May-06 11:12 
Questionsoftware layers Pin
mehrdadc4814-May-06 10:22
mehrdadc4814-May-06 10:22 
AnswerRe: software layers Pin
Robert Rohde14-May-06 18:58
Robert Rohde14-May-06 18:58 
QuestionInsert in DB Pin
mehrdadc4814-May-06 10:18
mehrdadc4814-May-06 10:18 
AnswerRe: Insert in DB Pin
Stefan Troschuetz14-May-06 10:33
Stefan Troschuetz14-May-06 10:33 
QuestionReset IIS from C# code? Pin
mikker_12314-May-06 9:48
mikker_12314-May-06 9:48 
AnswerRe: Reset IIS from C# code? Pin
Rei Miyasaka14-May-06 11:02
Rei Miyasaka14-May-06 11:02 
GeneralRe: Reset IIS from C# code? Pin
mikker_12314-May-06 11:08
mikker_12314-May-06 11:08 
QuestionIs there a way to create native exe? Pin
signbit14-May-06 8:34
signbit14-May-06 8:34 

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.