How to bind a List<DateTime> to a DataGridView/ListBox .NET C#

Posted by nat on Stack Overflow See other posts from Stack Overflow or by nat
Published on 2011-01-14T11:49:20Z Indexed on 2011/01/14 11:53 UTC
Read the original article Hit count: 159

Hi there

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

© Stack Overflow or respective owner

Related posts about .NET

Related posts about winforms