Thread: A small problem spoiling my application!

  1. #1
    Registered User
    Join Date
    Jan 2008

    A small problem spoiling my application!


    The problem is quiet trivial. Say suppose i have "Hello friendes{BACK}{BACK}s" in one file. Now when i print the file's contents in textbox it should print "Hello friends"
    ({BACK} = backspace key). I don't know how to do this. I tried

    but it's not working. I even tried this for loop

      while(1 > 0)
          int intIndex = StringToFormat.IndexOf("{BACK}");
          if (intIndex <= -1)
          if (intIndex == 0)
              StringToFormat = StringToFormat.Remove(0, 6);
              StringToFormat = StringToFormat.Remove(intIndex - 1, 7);
    because the user may press several backspaces simultaneously. Please help me!
    Thanks in advance

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Banks of the River Styx
    I don't believe that a \b makes any sense outside of the context of a terminal nowadays. A textbox will probably just draw one of those cute little boxes at you.

    The second method looked valid though... step through it with the debugger.

    (And... you ARE setting the value of the text box somewhere... right? Assuming it's a System.Windows.Forms.TextBox, the .Text property, IIRC.)
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Registered User
    Join Date
    Jan 2008
    Thanks Cactus_Hugger you are right it draws a funny little box. And ya, the while loop is absolutely correct actually the problem was somewhere else. I corrected it! Thanks anyways!

    Though when i use

    it works
    So i thought may be "\b" would also work

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. a very small problem, i'm new... please help?
    By Uberverse in forum C++ Programming
    Replies: 9
    Last Post: 11-10-2007, 10:44 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. Problem w/ console application compadibility
    By DarkMortar in forum C Programming
    Replies: 2
    Last Post: 05-16-2006, 07:13 PM
  4. Small program big problem :-(
    By Fibre Optic in forum C++ Programming
    Replies: 4
    Last Post: 09-20-2005, 08:53 AM
  5. Need Big Solution For Small Problem
    By GrNxxDaY in forum C++ Programming
    Replies: 8
    Last Post: 08-01-2002, 03:23 AM