ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2016-09-08 17:52:31

kwebster
Member
Registered: 2016-03-21
Posts: 9

MaxLength Property for Text Cell

Is there a way to set the maximum number of characters allowed in a text cell?

Last edited by kwebster (2016-09-08 17:52:51)


Never order the french onion soup in a Chinese restaurant.

Offline

#2 2016-09-13 16:02:21

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: MaxLength Property for Text Cell

You can use CellEditCharInputed event.

sheet.CellEditCharInputed += Sheet_CellEditCharInputed;

private void Sheet_CellEditCharInputed(object sender, CellEditCharInputEventArgs e)
{
	if (!string.IsNullOrEmpty(e.InputText) && e.InputText.Length >= 5)
	{
		// set InputChar as Zero to cancel new input characters
		e.InputChar = 0;
	}
}

Last edited by Jingwood (2016-09-13 16:04:11)

Offline

Board footer

Powered by FluxBB