我的代码有问题...初始化日期时间时看不到消息框。代码有什么问题?我根本找不到任何错误。我正在使用支持 DateTimePicker 的 WPF 修改应用程序。它看起来像这样:
private void Start_Click(object sender, RoutedEventArgs e)
{
startjob();
}
private void startjob()
{
DateTime start = (DateTime)DateTimePicker1.Value;
DateTime end = (DateTime)DateTimePicker2.Value;
DateTime now = DateTime.Now;
if ((now > start) && (now < end))
{
System.Windows.MessageBox.Show("It works");
}
XAML:
<wpfTool:DateTimePicker x:Name="DateTimePicker1" Margin="506,189,192,1137" Width="227" TimeFormat="LongTime">
</wpfTool:DateTimePicker>
<wpfTool:DateTimePicker x:Name="DateTimePicker2" Margin="506,238,192,1088" Width="227" Height="25">
</wpfTool:DateTimePicker>