We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

newline character

Thread ID:





16134 Jul 6,2004 06:48 PM UTC Jul 7,2004 07:14 AM UTC WinForms 2
Tags: GridControl
Corinne Muir
Asked On July 6, 2004 06:48 PM UTC

hi, we are using one of the cells as a multi-line text editor - it is only putting \n for the new line character - is there anyway to get it to do both \r\n ? thanks, Corinne

Administrator [Syncfusion]
Replied On July 6, 2004 10:30 PM UTC

The default textbox is based on RichTextBox which does not handle \r\n too well. But you could derive a cell control from the OriginalTextBox which is based on TextBox, and in the renderer, override OnKeyDown and handle the Enter key yourself. Here is a little sample. WindowsApplication20_5007.zip

Administrator [Syncfusion]
Replied On July 7, 2004 07:14 AM UTC

If you do not want to derive teh cell control, then you can just use the OriginalTextBox celltype and handle things in grid.CurrentCellControlKeyMessage this.gridControl1[2,2].CellType = "OriginalTextBox";
private void gridControl1_CurrentCellControlKeyMessage(object sender, GridCurrentCellControlKeyMessageEventArgs e)
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.RowIndex == 2 && cc.ColIndex == 2)
		Keys keyCode = (Keys) ((int)e.Msg.WParam) & Keys.KeyCode;
                //check for WM_KEYDOWN and Enter
		if(e.Msg.Msg == 256 && keyCode == Keys.Enter)
			GridOriginalTextBoxControl tb = cc.Renderer.Control as GridOriginalTextBoxControl;
			tb.SelectedText = "\r\n";
			e.Handled = true;


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon