在日历中选择的日期将在Windows应用程序中使用csharp显示在文本框中

问题描述:

使用日历在文本框中显示所选日期。





日期文本框(Calendarimage)


我选择15 feb意味着日期将显示文本框。



我该怎么办。请回复。



注意这是Windows应用程序。





问候

Narasiman P.

using calendar Display selected date in textbox.


Date textbox (Calendarimage)

in calendar i choose 15 feb means that date will display textbox.

how can i Do. Please reply.

Note It is windows application.


regards
Narasiman P.

标准WinForms中没有日历控件:DateTimePicker是最接近的,它总是显示日期无论如何,在文本框样式显示中,实际的日历需要打开控件。



所以,如果你正在使用其他控件,我们就不能帮助您显示信息而不知道有关实际控制的详细信息。



但是,作为一般规则,查找ValueChanged或DateChanged事件,以及处理它以显示你需要的东西。
There is no Calender control in standard WinForms: the DateTimePicker is about the closest, and it always shows the date in a text box style display anyway, with the actual calender requiring the control to be opened.

So, if you are using some other control, we can''t help you display information from it without knowing details about the actual control.

But, as a general rule, look for a "ValueChanged" or "DateChanged" event, and handle that to display what you need.


你好Narasima,



您应该在Windows窗体中使用DateTimePicker控件。并使用以下代码在文本框中显示日期



Hi Narasima,

You should use DateTimePicker control in your Windows Forms. and use Below Code to display the date in text box

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            DateTime dt = dateTimePicker1.Value;
            textBox1.Text = dt.ToString("dd-MMM-yy");
        }