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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Number format: Red color for negative number

Thread ID:





17815 Aug 17,2004 07:12 PM UTC Aug 17,2004 08:29 PM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On August 17, 2004 07:12 PM UTC

Hello, I''m wondering if there''s a way to emulate Excel''s number format for negative number, using the numberformat text. In Excel, it''s possible to put in color text (eg. [Red]) for the number format. The end user can change that through number format text. Is there a similar feature here? Thanks!

Administrator [Syncfusion]
Replied On August 17, 2004 08:29 PM UTC

You will have to use an event like PrepareViewStyleInfo to dynamically change the text color.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	double d;
	if(e.RowIndex > 0 && e.ColIndex == 2 
		&& double.TryParse(e.Style.Text, System.Globalization.NumberStyles.Any, null, out d)
		&& d < 0)
		e.Style.TextColor = Color.Red;


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon