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.

DropDown Cells MaxLength property

Thread ID:





8267 Oct 30,2003 02:52 AM Oct 30,2003 06:04 AM Windows Forms 2
Tags: GridControl
Denis Menard
Asked On October 30, 2003 02:52 AM

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 04:36 AM

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 06:04 AM

Works fine, thank you.


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.