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

Customizing Windows Forms DataGrid

Thread ID:





20153 Oct 11,2004 06:30 PM UTC Jan 16,2005 02:26 PM UTC WinForms 1
Tags: FAQ
Asked On October 11, 2004 06:30 PM UTC

Greetings: I used the methods described by Dr. Clay Burch in his article titled “Customizing the Windows Forms DataGrid”, the following link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_CustDataGrid.asp To summarize what I did (based on above method): I created a derived DataGridTextBoxColumn, which inherits from System.Windows.Forms.DataGridTextBoxColumn class overridden the Paint method. I added an event to this class so that it is fired to allow listeners to provide customized ForeColor and BackColor – based on CurrentCellValue - to be used for the cell being painted. A derived EventArgs provide the event listener with row index, column index, and CurrentCellValue values. My problem: When I specify a format, using DataGridTextBoxColumn.Format property, for my derived DataGridTextBoxColumn, the values in the columns are displayed unformatted. Only when the cell receives the focus, the formatted value is displayed. The same thing happens when apply format to downloaded sample code (provided through above link). I appreciate any solution and/or clue to resolve this problem.

Administrator [Syncfusion]
Replied On January 16, 2005 02:26 PM UTC

I have the same problem! Does anyone know the solution? E.g. I want to display the date using this format: dataColumn.Format = "MM/dd/yyyy" But because of the FormattableTextBoxColumn-class the date is displayed as it is saved in the database (the result of GETDATE() in a stored procedure). Cheers Lars


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