Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

I need to get a multi-line textbox to behave.

$
0
0

I am working with a windows form in C#.

I have a textbox with multi-line set as true.  The textbox is sized to approximately 20 chars x 4 lines as the data will eventually be sent to a 20x4 LCD display.  I'm trying to get it to break the lines out so they are useable one line at a time.

I'm running in to a few problems.

  1. If I enter each line and hit enter/return at the end of the line I have no problem.  It gives a \r\n at the end of the line and goes to the next.  No problems there. textbox.lines = string[4]
  2. If I enter all the text it wraps and reports as only one line (textbox.lines = string[1])
  3. If I enter a line, hit enter/return twice (moving to the 3rd line) I get some real garbage:
textbox.Text = "Some text here\r\r\n\n\r\nStatus = Lunch   \r\n                    \r\n                    "

textbox.lines = string[7] //I think it's 7...I don't have the code running right now
I'm open to suggestions.  Does anyone know a better way to implement a text input that I can limit to 20x4 chars and easily get the four lines?

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>