G
Guest
I have a RichTextBox (rtfTerminal below) in which I would like to replace the
last line with the last line minus its last character (i.e., do a backspace).
I tried the following code, wherein I first get a substring representing the
last line minus the last character, then rewrite it back over the last line.
The substring itself looks fine but assigning it to rtfTerminal.Lines[lineNo]
does not change rtfTerminal.Lines[lineNo]. As a matter of fact, I can assign
any string into rtfTerminal.Lines[lineNo] and it acts as if the assignment
never occurred. What am I missing? Thanks, as always.
string s = rtfTerminal.Lines[lineNo].Substring(0, colNo);
rtfTerminal.Lines[lineNo] = s;
last line with the last line minus its last character (i.e., do a backspace).
I tried the following code, wherein I first get a substring representing the
last line minus the last character, then rewrite it back over the last line.
The substring itself looks fine but assigning it to rtfTerminal.Lines[lineNo]
does not change rtfTerminal.Lines[lineNo]. As a matter of fact, I can assign
any string into rtfTerminal.Lines[lineNo] and it acts as if the assignment
never occurred. What am I missing? Thanks, as always.
string s = rtfTerminal.Lines[lineNo].Substring(0, colNo);
rtfTerminal.Lines[lineNo] = s;