I have a datagridview being populated by a collection of objects. the values within the first column are similar to:
"SOMEDISPLAYTEXT#T:\blasndw\lwwdjawn\wjnawdja"
"somedisplaytext#T:\kndwla\igrhysbv\kjnfak"
I do not wish to wish to change these values, as i am also constantly updating them, however, i wish the datagridview to only show the first part of this string 'somedisplaytext', up to but not including the '#' ..without changing the underlying values.
One way could be to create a property in your class which returns the formatted Text
If you use WinForms:
According to MSDN ( http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellformatting.aspx ), you can handle the CellFormating event of a DataGridView and then change the way the value is formatted.
This first method will change the background color if the column Artist contains "pink", and will change the format of the values in the column "Release Date" with the below method:
You can see here that you just have to replace the Value property of the DataGridViewCellFormattingEventArgs