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
  1. Home
  2. General Programming
  3. C#
  4. Replacing text in TextBox without the blinking

Replacing text in TextBox without the blinking

Scheduled Pinned Locked Moved C#
questionhelp
8 Posts 3 Posters 0 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.
  • O Offline
    O Offline
    Ollie1986
    wrote on last edited by
    #1

    Hey, I'm making a progress screen for an application and when I'm uploading a file he gives the "percentage progress" IN the text (realtime). That's nice and good BUT I always have to do: txt1.Text = txt1.Text.replace(previousPercentage, newPercentage) And because there is a lot of text in my textbox it starts to blink when it's refreshed (it doesn't blink when I add something to it). How can I solve this problem? thx!

    C P 2 Replies Last reply
    0
    • O Ollie1986

      Hey, I'm making a progress screen for an application and when I'm uploading a file he gives the "percentage progress" IN the text (realtime). That's nice and good BUT I always have to do: txt1.Text = txt1.Text.replace(previousPercentage, newPercentage) And because there is a lot of text in my textbox it starts to blink when it's refreshed (it doesn't blink when I add something to it). How can I solve this problem? thx!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      How often are you running the replace command ? Perhaps you need to run it on a string and then put that string in your label ?

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      O 1 Reply Last reply
      0
      • O Ollie1986

        Hey, I'm making a progress screen for an application and when I'm uploading a file he gives the "percentage progress" IN the text (realtime). That's nice and good BUT I always have to do: txt1.Text = txt1.Text.replace(previousPercentage, newPercentage) And because there is a lot of text in my textbox it starts to blink when it's refreshed (it doesn't blink when I add something to it). How can I solve this problem? thx!

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        Wrap the update up with a BeginUpdate(), EndUpdate() block.

        Deja View - the feeling that you've seen this post before.

        O 1 Reply Last reply
        0
        • P Pete OHanlon

          Wrap the update up with a BeginUpdate(), EndUpdate() block.

          Deja View - the feeling that you've seen this post before.

          O Offline
          O Offline
          Ollie1986
          wrote on last edited by
          #4

          txt1.BeginUpdate() ? --> doesn't work

          P 1 Reply Last reply
          0
          • C Christian Graus

            How often are you running the replace command ? Perhaps you need to run it on a string and then put that string in your label ?

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            O Offline
            O Offline
            Ollie1986
            wrote on last edited by
            #5

            Every 1sec (if you do it 50times a second its normal it blinks :p) And I place the wholl string in the txt in one time (every 1sec) thx

            1 Reply Last reply
            0
            • O Ollie1986

              txt1.BeginUpdate() ? --> doesn't work

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              Not the textbox, but the whole update of your control.

              Deja View - the feeling that you've seen this post before.

              O 1 Reply Last reply
              0
              • P Pete OHanlon

                Not the textbox, but the whole update of your control.

                Deja View - the feeling that you've seen this post before.

                O Offline
                O Offline
                Ollie1986
                wrote on last edited by
                #7

                Hey, Do I have to import something for that? And what do you mean with the whole update of your control? Do I have to make a new class, instance, interface? Our just: BeginUpdate(); ApplicationDirector.Instance.removeCharachtersFromProgressScreen(lenghtWrittenString); EndUpdate(); (but that doesn't work) :)

                P 1 Reply Last reply
                0
                • O Ollie1986

                  Hey, Do I have to import something for that? And what do you mean with the whole update of your control? Do I have to make a new class, instance, interface? Our just: BeginUpdate(); ApplicationDirector.Instance.removeCharachtersFromProgressScreen(lenghtWrittenString); EndUpdate(); (but that doesn't work) :)

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  Say you have a progressbar control with the text on it (we'll call an instance of it superProgressBar), then you would normally do superProgressBar.BeginUpdate();superProgressBar.Increment();superProgressBar.EndUpdate(); The Increment method would be responsible for updating the scroll bar and writing the text on it. Also, you might want to consider setting up double buffering. Use the following

                  this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer,true);
                  

                  Deja View - the feeling that you've seen this post before.

                  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