![]() |
| | #1 |
| Registered User Join Date: Jan 2008
Posts: 225
| 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 Code: stringvariable.Replace("{BACK}","\b");
Code: while(1 > 0)
{
int intIndex = StringToFormat.IndexOf("{BACK}");
if (intIndex <= -1)
break;
if (intIndex == 0)
StringToFormat = StringToFormat.Remove(0, 6);
else
StringToFormat = StringToFormat.Remove(intIndex - 1, 7);
}
Thanks in advance |
| chottachatri is offline | |
| | #2 |
| int x = *((int *) NULL); Join Date: Jul 2003 Location: Banks of the River Styx
Posts: 902
| 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) |
| Cactus_Hugger is offline | |
| | #3 |
| Registered User Join Date: Jan 2008
Posts: 225
| 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 Code: stringvariable.Replace("{ENTER}","\r\n");
![]() So i thought may be "\b" would also work |
| chottachatri is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| a very small problem, i'm new... please help? | Uberverse | C++ Programming | 9 | 11-10-2007 10:44 AM |
| A question related to strcmp | meili100 | C++ Programming | 6 | 07-07-2007 02:51 PM |
| Problem w/ console application compadibility | DarkMortar | C Programming | 2 | 05-16-2006 07:13 PM |
| Small program big problem :-( | Fibre Optic | C++ Programming | 4 | 09-20-2005 08:53 AM |
| Need Big Solution For Small Problem | GrNxxDaY | C++ Programming | 8 | 08-01-2002 03:23 AM |