繁体   English   中英

C#从日历中获取选定的日期并将其显示在消息框中

[英]C# getting a selected date from calendar and displaying it in a message box

C#从日历中获取选定的日期,并将其显示在消息框中,该数据随后将用于自动生成的电子邮件中。

我在Visual Studio 2012中使用标准的Month日历,希望将用户选择的日期与其余数据一起显示在消息框中,但是我发现很难仅浏览所选的日期日期,而不是整个日期范围。

我对C#非常了解,目前正在大学里学习它,但是:S。没有涵盖。

这是我到目前为止的内容:

    //Calendar
    private void completionCalendar_DateChanged(object sender, DateRangeEventArgs e)
    {

    }



//Button
        private void submitButton_Click(object sender, EventArgs e)
        {
//pretty sure the maxselectioncount is in the wrong place 

        completionCalendar.MaxSelectionCount = 1;

   MessageBox.Show("Date they start: " + completionCalendar);

        }

我只是在寻找一个简单易用的/ dd / mm / yyyy甚至dd-mm-yyyy等,有什么帮助吗?

试试上面

   private void submitButton_Click(object sender, EventArgs e)
    {

        MessageBox.Show("Date they start: " + completionCalendar.SelectionEnd.ToString("dd-mm-yyyy"));

    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM