相关疑难解决方法(0)

如果未选择日期,如何设置datetimepicker为空值(c#winforms)

Binding b = new Binding( "Value", person, "BdayNullable", true );
dtBirthdayNullable.DataBindings.Add( b );
b.Format += new ConvertEventHandler( dtBirthdayNullable_Format );

b.Parse += new ConvertEventHandler( dtBirthdayNullable_Parse );

void dtBirthdayNullable_Format( object sender, ConvertEventArgs e )
{
    // e.Value is the object value, we format it to be what we want to show up in the control

    Binding b = sender as Binding;
    if ( b != null )
    {
        DateTimePicker dtp = (b.Control as DateTimePicker);
        if ( dtp != null )
        {
            if …
Run Code Online (Sandbox Code Playgroud)

c# datetimepicker winforms

16
推荐指数
2
解决办法
7万
查看次数

标签 统计

c# ×1

datetimepicker ×1

winforms ×1