Sign in to follow this  

[.net] How to give line number in a textBox?

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

1. I want to generate some kind of a log file using a multiline textBox and I have to give line number to it so that it is clear for user to know the detailed events. How to do that? 2. Everytime there is an event occured, I want to add a new line in the textBox. How to do that? I've tried the textBox->AppendText but it cannot create a new line, it places the appended text next to the last text. How to solve this? Thank you very much.. [Edited by - chrisliando on February 11, 2008 12:56:39 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by chrisliando
2. Everytime there is an event occured, I want to add a new line in the textBox. How to do that? I've tried the textBox->AppendText but it cannot create a new line, it places the appended text next to the last text.

If you're not including "\r\n" before the string to be appended, then you should be. For reasons I've never fully understood, a single '\n' won't do it, the carriage return is necessary.

Share this post


Link to post
Share on other sites
Are you asking for a source-code solution that you can copy/paste?
Or are you asking us to explain the concept of string concatenation?

i = 1
for each line
line = i++ + line + "\r\n"



To make the line number not selectable, you'd be better off using a different approach all together, "like a multi-column list control" (to quote Zao).

Share this post


Link to post
Share on other sites
No, everything is ok for me. If there is source code, then I will use it, if not it's also ok. I just confused.

But how to integrate the multi-column list control with the textBox?

Thank you.

Share this post


Link to post
Share on other sites

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this