How to bind a List<DateTime> to a DataGridView/ListBox .NET C#
I have a 开发者_运维知识库List that I want to bind to a DataGridView in a windows forms app. however, I cannot for the life of me find the DataPropertyName I need to show what I want. I have had similar problems with binding this list to a listbox.
what i really want is to show .ToString("dddd, dd MMMM yyyy HH:mm"), or certainly more than the standard 'date' part of the datetime - do i need to add a property of my own?
public partial class DateTime{
public string myFormat{
get{return this.ToString("dddd dd MMM yyyy HH:mm");}
}
}
or some such?
thanks
nat
For a DataGridView, this MSDN article explains how to format dates.
精彩评论