Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Two Questions for the Guru's

Two Questions for the Guru's

Scheduled Pinned Locked Moved C#
questionlearning
4 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bscott3125
    wrote on last edited by
    #1
    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 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
    M J 2 Replies Last reply
    0
    • B bscott3125
      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 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
      M Offline
      M Offline
      MultiThread
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • B bscott3125
        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 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
        J Offline
        J Offline
        jparsons
        wrote on last edited by
        #3

        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

        S 1 Reply Last reply
        0
        • J jparsons

          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

          S Offline
          S Offline
          Sphynx_Roland
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups