Dear All, I really need help with my problem I want to Change textbox entered value to the exact month for example: TextBox.Text = "1", when enter this should change DateTimePicker to ="01/01/2018". for other months TextBox.Text = "2", when enter this should change DateTimePicker to ="01/02/2018". until TextBox.Text = "12", when enter this should change DateTimePicker to ="01/12/2018".
private void myTextBox_TextChanged(object sender, EventArgs e) { int month; if (int.TryParse(myTextBox.Text, out month)) { DateTime dt = myDateTimePicker.Value; myDateTimePicker.Value = dt.AddMonths(month - dt.Month); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)