windowsforms-devexpress-dot-xtraeditors.md
A multi-line text editor.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public class MemoEdit :
TextEdit,
IAutoHeightControl,
IAutoHeightControlEx,
ISupportScrollBarColorize
Public Class MemoEdit
Inherits TextEdit
Implements IAutoHeightControl,
IAutoHeightControlEx,
ISupportScrollBarColorize
Use the MemoEdit control to display and edit multi-line text. The MemoEdit can be used as a standalone editor or embedded in a container control (for example, Data Grid, TreeList, etc.).
Use the MemoEdit.Text or MemoEdit.EditValue property to specify the edit value:
string memoText = "The DevExpress WinForms Subscription ships with a comprehensive suite of award-winning Microsoft Office-inspired user interface components. From our blazing fast WinForms Data Grid and Pivot Grid to our Excel-inspired Spreadsheet and Word-inspired Rich Text Editor for Windows Forms, the DevExpress WinForms subscription has everything you'll need to create apps that meet and exceed end-user expectations.";
memoEdit1.Text = memoText;
Dim memoText As String = "The DevExpress WinForms Subscription ships with a comprehensive suite of award-winning Microsoft Office-inspired user interface components. From our blazing fast WinForms Data Grid and Pivot Grid to our Excel-inspired Spreadsheet and Word-inspired Rich Text Editor for Windows Forms, the DevExpress WinForms subscription has everything you'll need to create apps that meet and exceed end-user expectations."
memoEdit1.Text = memoText
The MemoEdit automatically wraps long text. Set the MemoEdit.Properties.WordWrap property to false to disable this feature. When word wrapping is disabled, the MemoEdit splits the text at each \r\n escape character.
string memoText = "The DevExpress WinForms Subscription ships with\r\na comprehensive suite of award-winning\r\nMicrosoft Office-inspired user interface\r\ncomponents.";
memoEdit1.Properties.WordWrap = false;
memoEdit1.Text = memoText;
Tip
Use the MemoEdit.Lines property to specify an array of strings. You can also use this property to obtain specific text lines separated by \r\n characters.
string[] memoList = new string[] {
"Line 1",
"Line 2",
"Line 3"
};
memoEdit1.Lines = memoList;
string line2 = memoEdit1.Lines[1];
Use the MemoEdit.Properties.ScrollBars property to display horizontal, vertical, or both horizontal and vertical scrollbars. The MemoEdit automatically enables or disables scrollbars as needed.
Use the following properties to specify how the MemoEdit handles Enter and Tab key presses:
MemoEdit.Properties.AcceptsReturnIf enabled, pressing Enter starts a new line. If disabled, Enter key presses are handled by the form.MemoEdit.Properties.AcceptsTabSpecifies whether the Tab key inserts a tab character in the editor or moves focus to the next UI control on the form.
The following code snippet uses the RepositoryItemMemoEdit to display and edit long text in the WinForms Data Grid control (the Data Grid control was created and customized at design time).
Tip
Enable the grid’s RowAutoHeight option to automatically adjust row heights based on cell content.
Use the MemoEdit.Properties.LinesCount property to specify the maximum height of the MemoEdit (in text lines) when embedded in a container control.
using System;
using System.Windows.Forms;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraEditors.Repository;
namespace GridFindPanel {
public partial class Form1 : RibbonForm {
RepositoryItemMemoEdit riMemoEdit;
public Form1() {
InitializeComponent();
gridControl.ForceInitialize();
riMemoEdit = new RepositoryItemMemoEdit() {
AcceptsTab = true,
AcceptsReturn = true,
LinesCount = 5
};
gridControl.RepositoryItems.Add(riMemoEdit);
gridView.Columns["Notes"].ColumnEdit = riMemoEdit;
gridView.OptionsView.RowAutoHeight = true;
}
private void Form1_Load(object sender, EventArgs e) {
// This line of code loads data into the 'nwindDataSet1.Employees' table.
this.employeesTableAdapter.Fill(this.nwindDataSet1.Employees);
}
}
}
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraBars.Ribbon
Imports DevExpress.XtraEditors.Repository
Namespace GridFindPanel
Partial Public Class Form1
Inherits RibbonForm
Private riMemoEdit As RepositoryItemMemoEdit
Public Sub New()
InitializeComponent()
gridControl.ForceInitialize()
riMemoEdit = New RepositoryItemMemoEdit() With {
.AcceptsTab = True,
.AcceptsReturn = True,
.LinesCount = 5
}
gridControl.RepositoryItems.Add(riMemoEdit)
gridView.Columns("Notes").ColumnEdit = riMemoEdit
gridView.OptionsView.RowAutoHeight = True
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
' This line of code loads data into the 'nwindDataSet1.Employees' table.
Me.employeesTableAdapter.Fill(Me.nwindDataSet1.Employees)
End Sub
End Class
End Namespace
In this example, MemoEdit operates in Advanced Mode. Features include:
Object MarshalByRefObject Component Control DevExpress.XtraEditors.XtraControl ControlBase BaseControl BaseEdit TextEdit MemoEdit
See Also