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.
Unfortunately, activation email could not send to your email. Please try again.

newline character

Thread ID:





16134 Jul 6,2004 02:48 PM Jul 7,2004 03:14 AM Windows Forms 2
Tags: GridControl
Corinne Muir
Asked On July 6, 2004 02:48 PM

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 06:30 PM

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 03:14 AM

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.

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.