MultiRow Windows Forms > Developer's Guide > Using MultiRow > Cell Types > TextBoxCell > 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.
Use the following steps to allow line breaks in a text box cell.
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.
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() |
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.