【问题标题】:How to remove the calendar control from TrueDBGrid如何从 TrueDBGrid 中删除日历控件
【发布时间】:2012-02-28 21:08:35
【问题描述】:

从 TrueDBGrid 单元格中删除日历控件 David [ON,加拿大] 2012 年 2 月 26 日 09:39:51

在 windows7 上的 Visual Studio 2010 中使用 C1.Win.C1TrueDBGrid.2(版本 2.0.20111.61210)时。我将网格 DataSource 分配给数据表

VB.Net

Grid1.DataSource = MyDataset
Grid1.DataMember = "table1" 'table1 is one of Mydataset tables
Grid1.Rebind()
Grid1.Refresh()

表格中有一个字段是日期值,那么单元格中有一个日历控件,我只能点击日历选择一天,但是我想去掉单元格中的日历控件,怎么办它?感谢任何帮助!

【问题讨论】:

    标签: c# .net vb.net truedbgrid


    【解决方案1】:

    使用以下代码在 VB.Net 中关闭 EnableDateTimeEditor

    Grid1.Columns(index #).EnableDateTimeEditor = False

    index#是Column的索引#

    【讨论】:

    • 您还可以在查询中将该字段强制转换为 VARCHAR(),这样 DataSet 中的 DataTable 的类型为 String 而不是 Date。
    【解决方案2】:

    如果您对列进行排序,请不要使用 HardCode 的解决方案,因为对字符串日期进行排序将无法正常工作。我建议将该字段保留为 DateTime 并使用 David Li 的答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多