【问题标题】:MonthCalender to textbox [duplicate]MonthCalender 到文本框 [重复]
【发布时间】:2012-10-13 17:03:21
【问题描述】:

可能重复:
How to use MonthCalender to insert date in text box?

我有textBox1MonthCalender1 如何将日历中的选定日期映射为textBox1 中的字符串?

【问题讨论】:

    标签: c# .net winforms visual-studio


    【解决方案1】:

    在选定的日历更改事件中试试这个:

    protected void MonthCalender1 _SelectionChanged(object sender, EventArgs e)
    {
        System.DateTime myDate = MonthCalender1 .SelectedDate;
    
        textBox1.Text = myDate.ToString ("dd/MM/yyyy"); 
    }
    

    【讨论】:

    • 日历已选择日期属性。访问下面的 msdn 链接:msdn.microsoft.com/en-us/library/…
    • 射击,我在看MonthCalendar 出于某种奇怪的原因。
    • @WajidAli : System::DateTime^ myDate = monthCalendar1->SelectedDate; 显示错误:Error 3 error C2039: 'SelectedDate' : is not a member of 'System::Windows::Forms::MonthCalendar' c:\users\40612010\desktop\hrnimr2\hrnimr\Form1.h 1819
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-05
    • 2017-04-24
    • 1970-01-01
    • 2014-09-09
    • 2010-12-15
    • 2013-09-01
    • 1970-01-01
    相关资源
    最近更新 更多