我想自动将datetimepicker设置为日期,例如我在文本框中写了1个月。那可能吗?请帮帮我们,谢谢!
答案 0 :(得分:0)
您可以尝试例如:
Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
DateTimePicker1.Value = DateTimePicker1.Value.AddMonths(Convert.ToInt32(TextBox1.Text))
End Sub
您可以使用AddDays,AddMonths或AddYears来修改dateTimePicker的值