Two Questions for the Guru's
-
- When my app is running a large process it freezes up the app so that you can't move it or minimize it, etc. until the process is done. How do you avoid this. I tried threads and that didn't seem to do it, is there a function to the give control back to the app like repaint or something 2) I have a paragraph of text that I need to escape chr(10) and chr(13) characters from. How would you do this using the string.replace function? Thanks in advance, sorry for the lame questions, still learning. -Brent
-
- When my app is running a large process it freezes up the app so that you can't move it or minimize it, etc. until the process is done. How do you avoid this. I tried threads and that didn't seem to do it, is there a function to the give control back to the app like repaint or something 2) I have a paragraph of text that I need to escape chr(10) and chr(13) characters from. How would you do this using the string.replace function? Thanks in advance, sorry for the lame questions, still learning. -Brent
Greets, It is annoying when your UI isn't repainting when performing lengthy operations. However, Application.DoEvents() may do the trick for sending the appropriate messages required to repaint. In C#, "\r\n" is the same as the chr(10) and chr(13) pair. That is what they are if you need to find them. "\r" is chr(10) (carriage return) and "\n" is newline. In the old days, a person that didn't send a newline really made things difficult to read. :) BTW, the .NET library has a platform specific way of using a carriage return / newline pair, that's using the System.Environment.Newline property. Regards, Joe
-
- When my app is running a large process it freezes up the app so that you can't move it or minimize it, etc. until the process is done. How do you avoid this. I tried threads and that didn't seem to do it, is there a function to the give control back to the app like repaint or something 2) I have a paragraph of text that I need to escape chr(10) and chr(13) characters from. How would you do this using the string.replace function? Thanks in advance, sorry for the lame questions, still learning. -Brent
bscott3125 wrote: 1) When my app is running a large process it freezes up the app so that you can't move it or minimize it, etc. until the process is done. How do you avoid this. I tried threads and that didn't seem to do it, is there a function to the give control back to the app like repaint or something Your program is currently single threaded. When you are preforming lenghty operations your application will not perform UI operations. To prevent this, you can run lengthy operations on a separate thread. Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n
-
bscott3125 wrote: 1) When my app is running a large process it freezes up the app so that you can't move it or minimize it, etc. until the process is done. How do you avoid this. I tried threads and that didn't seem to do it, is there a function to the give control back to the app like repaint or something Your program is currently single threaded. When you are preforming lenghty operations your application will not perform UI operations. To prevent this, you can run lengthy operations on a separate thread. Jared jparsons@jparsons.org www.prism.gatech.edu/~gte477n
Jared is proberly right about your app being single threaded. If you are absolutely shure you have tried multiple threading and the problem is still there, you encountered another problem. In this case it's very likely your 'large process' is eating up all the system cpu resource. This does cause other applications to hang too and you will probably only have acces to the windows task manager. At least untill you process has finished. To avoid this kind of problem, you will probably have to lower the process priority of your 'large process' its threat. I don't exactly know how to do this in C#.NET. I hope this helps you a little further, but be shure to check first whether or not your app is really multi threathed.