Converting integer values to duration values (hours & minutes) on Gridview

M

Marc Gravell

What is the data-source? If it is object-based, you might be able to
set the TypeConverter of the property. Certainly DataGridView respects
TypeConverter, and I /imagine/ that GridView does too. I can explain
more if needed, but essentially you'd have:

public class SomeWossit {
[TypeConverter(typeof(MinutesConverter))]
public int SomeValue {...}
}

If that isn't suitable, there are (again, in DataGridView - not 100%
sure about GridView) formatting events that you could hook into.

Marc
 
M

Marc Gravell

Of course, if you *do* have a class-based system, you can always just
add a second property to reflect this... i.e. have a string property
that does the math and returns "1h 3m" or whatever, and bind to this
instead...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top