The line
dateTimePicker1.Text = MessageBox.Show(textBox1.Text +);
is going to cause you two errors
1. There is a spurious
+
sign after
textBox1.Text
2. MessageBox.Show does not return a string. Even if you add
.ToString()
to it you will then get an error from the dateTimePicker saying that the text you are trying to insert into it is not a valid datetime format
Change the line to
MessageBox.Show(textBox1.Text);
or preferably just remove it altogether - it's only repeating some of the stuff from the previous message
[EDIT - some further assistance for the OP]
Things to consider ...
Don't start your timer when you load the form, start it after the time has been changed by the user... and make sure it is enabled e.g.
private void button1_Click(object sender, EventArgs e)
{
myTimer.Enabled = true;
myTimer.Start();
}
You actually only want the message box to appear if the time for the reminder has passed,
so you will need to compare the current date & time against that set in the datetimepicker e.g.
if (DateTime.Now >= this.dateTimePicker2.Value)
{
MessageBox.Show(this.textBox1.Text);
myTimer.Enabled = false;
}
Finally, make sure your DateTimePicker is set to the correct format
dateTimePicker2.Format = DateTimePickerFormat.Time;
If you are still struggling then have a read of this CodeProject article
Use a timer to create a simple alarm application[
^]