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

newline character

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

2 Replies

AD Administrator Syncfusion Team July 6, 2004 06:30 PM

The default textbox is based on RichTextBox which does not handle \r 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


AD Administrator Syncfusion Team 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";
			e.Handled = true;
		}
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon