GrapeCity MultiRow Windows Forms Documentation
Input Line Break (TextBoxCell)

The user can use the Shift + Enter key to input a line break at runtime. This is the same key used in the System.Windows.Forms.TextBox.

Using the Designer

Use the following steps to allow line breaks in a text box cell.

  1. Select the text box cell in which you wish to allow line breaks (for example: textBoxCell1)
  2. Drag the cell and make its height about twice the current size.
  3. From the Properties window, select the TextBoxCell.Style.Multiline property and choose True from the drop-down list.
  4. Change the designer document window tab to Runtime.
  5. Input the line break using the Shift + Enter key.

Using Code

The following code enables multiple lines and adds a line break to the cell. This is similar to how you would do this with a TextBox control.

[VB]

Imports GrapeCity.Win.MultiRow

GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {New TextBoxCell()})
' Enable multiline
GcMultiRow1.Rows(0).Cells(0).Style.Multiline = MultiRowTriState.True
GcMultiRow1.Rows(0).Cells(0).Value = "Hello" & vbCrLf & "World"
' Auto adjust cell height
GcMultiRow1.Rows(0).Cells(0).PerformVerticalAutoFit()

[CS]

using GrapeCity.Win.MultiRow;

gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { new TextBoxCell() });
// Enable multiline
gcMultiRow1.Rows[0].Cells[0].Style.Multiline = MultiRowTriState.True;
gcMultiRow1.Rows[0].Cells[0].Value = "Hello\r\nWorld";
// Auto adjust cell height
gcMultiRow1.Rows[0].Cells[0].PerformVerticalAutoFit();

For information about multiple lines and word wrap, refer to Multiline and Word Wrap.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options