Text Box Manipulation

  • Thread starter Thread starter kalamantina
  • Start date Start date
K

kalamantina

Hi everyone,
I have an issue under which I have a multiline text box that can
display six lines or 650 characters of Code, the problem is that a
carriage return counts as a line, so if the user presses the enter
button six times the cursor is all the way at the bottom fo the report,
and the requirements says he cannot do any more enter buttons.

I tried catching the event and catching the carriage return
(e.Char(13)), and I allow 5 entries after which I handle the event and
nothing happens on the Text Box.
this is not convenient becuase if the user hits backspace or uses the
mouse to put the cursor on another place in the textbox, he should be
abl;e to use the enter button and the carriage return should take
effect, I don;t know what other ways to do this might be, maybe
detecting the cursor location in the TextBox?

Any Help is always welcomed
 
The TextBox has a property called Lines which returns an array of the
lines of text. You could count the number of elements in the array to
see if the maximum has been exceeded.

You'd probably need to intercept the carriage-return keys and block
them if the limit has already been reached.
 
Hi Roger,
I did that and everything is fine with it, I control the number of
lines a user can input into the text box.
Another problem arose, which is that the user can copy and paste code
that might overflow to the nxt line, and the problem persists
 
Back
Top