We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Validation - Regular Expression for Numeric and Operator that results in numeric

Hi

What regular expression should i used in the below mentioned statement so that it allows only numeric OR the operators that results in a numeric value.

grdDataEntry.Worksheets(0).Columns(0).AddValidation(False, “\d+”)



Hi,

Thanks for your inquiry.

We only provide a way to allow the users to set their regular expressions. Well, you should decide it by yourself what regular expression to enter and whether it is feasible enough. Since your regular expression (numbers plus operators etc.) is to complex to be evaluated as both conditions would be diverse and unusual when attached together. We recommend you to use just one condition e.g., input numeric values only. And, if you need to input the formula entries e.g.., "3+5", you can try to input the "=3+5" into the Cell's formula string the value would display as 8, not sure if it suits your need.

Thank you.

Hi

Ok. Its fine. Another query regarding validations. I am using following statement in my code.

grdDataEntry.Worksheets(0).Columns(0).AddValidation(False, “\d+”)

And it gives me a message ‘The value you entered is not valid’, if I give some wrong value.

Can I give customized message here, i.e. Can I change the contents of the message and the header of the information box?

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

You can use grdDataEntry.Worksheets(0).Columns(0).Validation.CustomMsgForStopEdit property to set the custom error you want to display.

Thank You & Best Regards,

Thanks. But can we also change the header of Message box. At the moment it reads “Validation”

Hi,

Thank you for considering Aspose.

Well, currently this feature is not supported "to change the title of the validation message box". we will see if we can provide it in our future release.

Thank You & Best Regards,

Hi,

Please try the attached fix. The feature to change the title of the validation messagebox is supported now.

Sample code:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

_gridDesktop.Worksheets[0].Columns[0].AddValidation(false, "\\d+");

_gridDesktop.Worksheets[0].Columns[0].Validation.CustomMsgTitle = "custom title";

Thank you.