【问题标题】:Display a complete date into a Grid C#在网格 C# 中显示完整的日期
【发布时间】:2018-05-26 18:29:42
【问题描述】:

我有一个网格,它在列中显示一个日期,但日期的格式不适合我。 确实,它只显示最后两位数字...关闭我希望我能看到最后 4..

你有什么想法吗?

谢谢!

Capture

【问题讨论】:

  • Winforms 还是 WPF?请标记。
  • datagridview:可以设置CellStyle.Format。注意:gridview != datagridview != grid - 总是用正确的名字称呼事物!
  • @Alexander Winforms ofc ;-)
  • @Taw Thx for the CellStyle.Format!

标签: c# .net gridview datagridview grid


【解决方案1】:

在 Taw 的帮助下,我做了一些研究,在这里我可以解决我的问题:

我只是添加了一个变量:

string customFormat = "dd/MM/yyyy";

然后:

        gridPrix.Columns[1].DefaultCellStyle.Format = customFormat;
        gridPrix.Columns[2].DefaultCellStyle.Format = customFormat;

谢谢 ;-)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-26
    • 1970-01-01
    • 1970-01-01
    • 2020-06-05
    • 1970-01-01
    • 2015-05-21
    • 1970-01-01
    相关资源
    最近更新 更多