我想与日期摘要器一起制定一个议程,但我对此有一些麻烦。因此,我有一个日期选择器和2个按钮,1个按钮插入字符串(输入框),另一个按钮显示字符串(MessageBox)。但是我想在选定的日期显示字符串。因此,例如,如果我选择5/15/2015,我想在该日期插入一个字符串,然后当我要显示字符串时,只有在日期日期为5/15/2015时才显示。
谢谢,
public partial class Form1 : Form
{
string inputdate { get; set; }
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
inputdate = Interaction.InputBox("Voeg plan toe");
}
private void button2_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e){
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
MessageBox.Show("Selected Date: " + dateTimePicker1.Text, "DateTimePicker", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
可以说,我选择日期5/15/2015我想通过按钮(输入框)示例插入字符串:" John的生日"。使用我的按钮2(消息框),我想检查我计划的5/15/2015,因此它将显示" John的生日"。
dateTimePicker1.Value.ToString();
这应该有所帮助。由于DateTimePicker与值一起使用,而不是将其值转换为您的消息框的字符串。希望它有帮助