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.
Syncfusion Feedback

DropDown Cells MaxLength property

Thread ID:

Created:

Updated:

Platform:

Replies:

8267 Oct 30,2003 07:52 AM UTC Oct 30,2003 11:04 AM UTC Windows Forms 2
loading
Tags: GridControl
Denis Menard
Asked On October 30, 2003 07:52 AM UTC

Hello, I would like to set the MaxLength property of the textbox part of a ComboBox cell and a GridListControl cell in a virtual grid. I've tried to set the MaxLength property in the QueryInfoCell event - the length isn't limited. I've tried to set the MaxLength property of the TextPart of the renderer in the PrepareViewStyleInfo event - the length isn't limited either. Could you give me some advises please ?

Administrator [Syncfusion]
Replied On October 30, 2003 09:36 AM UTC

Maybe you could use the CurrentCellKeyPress event. In it, identify the cell somehow and check the current length and set the e.Handled to true to ignore the keystroke.
private void gridControl1_CurrentCellKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.RowIndex == 2 && cc.ColIndex == 3 && cc.Renderer.ControlText.Length >= 4)
	{
		e.Handled = true;
	}
}

Denis Menard
Replied On October 30, 2003 11:04 AM UTC

Works fine, thank you.

CONFIRMATION

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.

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

;