开发者

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

开发者 https://www.devze.com 2023-02-04 21:47 出处:网络
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 simil

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

精彩评论

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

关注公众号