Home Tour! Products Download Purchase Support Company Contacts  

Question

I have a Multi-line TextBox control that will hold all the Attributes values in a block. Each line of the TextBox control is one attribure value. The problem is that I don't want the user to be able to press the enter key, and add a new line.

For some reason the 'ReturnPressed' event is not allowed in Multi-line TextBox control. Is there a way to circumvent this so the event can fire or maybe you have another solution.

Answer

Set the FilterStyle property of the TextBox to 'String', not 'MultilineString'. The text of the control must be set during run-time. Using the method below, add the text \r\n to insert a return character(s) in the text.

(Odcl_Control_SetText Example_ExampleForm_TextBox1
          "Line1\r\nLine2\r\nLine3\r\nLine4")

Using the \r\n with a text box of FilterStyle 'MultilineString' will allow the user to move the cursor around in the control but they cannot add or remove lines of text.

Home Products Download Purchase Support Company Contacts