[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

Car Return in Text Box

Hi, my name is Alex.

Using C#:

I have a text box in my program and every 30 characters I want to add a car return character.

//Example:

if (this.txtRemarks .Text .Length == 30)
                  {
this.txtRemarks .Text += “\n”;
                  }


When I this is executed the cursor returns to the beginning of the line but does not go to the next line.

I tried to enter (char)13 but is doing the same.

I was using a regular text box from tools and I changed it for Rich text box; It still doing the same.

Can any one help me please;
0
cyborgcom
Asked:
cyborgcom
1 Solution
 
StillUnAwareCommented:
You must set an option of text box to be multiline
0
 
cyborgcomAuthor Commented:
Multiline is true

I am able to enter text and car returns my self but when that condition is true only retuen the car to the beginning and does not create a new line
0
 
cyborgcomAuthor Commented:
is there other oprion to insert a car return?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jaime OlivaresCommented:
try with:
this.txtRemarks .Text += “\r\n”;
0
 
StillUnAwareCommented:
You can try adding the windows native new line characters:

13 followed by 10
0
 
cyborgcomAuthor Commented:
You mean :

this.txtRemarks .Text += (char)13 + (char)10      ?
0
 
cyborgcomAuthor Commented:
this.txtRemarks .Text += “\r\n”;

Still not working
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
How about...

        private void txtRemarks_TextChanged(object sender, EventArgs e)
        {
            if (txtRemarks.TextLength % 30 == 0)
            {
                txtRemarks.AppendText(Environment.NewLine);
            }
        }
0
 
cyborgcomAuthor Commented:
Idle_Mind

I am trying to do the same but in a FormField TextBox in Office Word 2003
Can you help me with the Macro?
0
 
cyborgcomAuthor Commented:
I have a Text Box and I want to break this string just like the c# example you showed me
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now