开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜