Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to use a RichTextBox as a command prompt for my application. During runtime I want to get the last line from the RichTextBox. How can I do that?

Thanks in advance.
Posted
Updated 2-Nov-10 3:59am
v2

you should check given link to get your answer

Command Prompt Control[^]
 
Share this answer
 
C#
string lastLine = myRichTextBox.Lines.Length == 0 ? string.Empty : myRichTextBox.Lines[myRichTextBox.Lines.Length - 1];
 
Share this answer
 
v2
Comments
shoni k 2-Nov-10 23:50pm    
when using this code the following error is shown
operator'=='cannot be applied to operands of type 'method group' and 'int'
operator'-'cannot be applied to operands of type 'method group' and 'int'
Toli Cuturicu 3-Nov-10 6:16am    
Then use Length instead of Count!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900