Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 捕获两个时间编辑时间表_C#_Vb.net_Winforms_Visual Studio 2010_Datetime - Fatal编程技术网

C# 捕获两个时间编辑时间表

C# 捕获两个时间编辑时间表,c#,vb.net,winforms,visual-studio-2010,datetime,C#,Vb.net,Winforms,Visual Studio 2010,Datetime,我有这个示例表单,它设置并比较了两个时间表 如果第二个计划介于第一个计划(时间开始和时间结束)之间,我想限制第二个计划无法设置的时间 例如: 第一附表: 上午8:00:00至10:00:00 我想限制第二个时间表,这样它就不能设置在第一个时间表之间,比如8:30:00,9:00:00,9:30:00等等。它将设置为上午10:00:00或以上。我怎么可能做到这一点? 我做过一些代码,但想知道怎么做对我来说很难。有人能帮忙吗 以下是我的示例代码: Private Sub Test_Click(B

我有这个示例表单,它设置并比较了两个时间表

如果第二个计划介于第一个计划(时间开始和时间结束)之间,我想限制第二个计划无法设置的时间

例如: 第一附表: 上午8:00:00至10:00:00 我想限制第二个时间表,这样它就不能设置在第一个时间表之间,比如8:30:00,9:00:00,9:30:00等等。它将设置为上午10:00:00或以上。我怎么可能做到这一点?

我做过一些代码,但想知道怎么做对我来说很难。有人能帮忙吗

以下是我的示例代码:

 Private Sub Test_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If timeStart.EditValue > timeEnd.EditValue Then
            XtraMessageBox.Show("Time end must higher than time start", "", MessageBoxButtons.OK, MessageBoxIcon.Hand)
            Exit Sub
        ElseIf timeStart.EditValue = timeEnd.EditValue Then
            XtraMessageBox.Show("Time start must not be equal to time end", "", MessageBoxButtons.OK, MessageBoxIcon.Hand)
            Exit Sub
        ElseIf timeStart1.EditValue < timeEnd.EditValue Then
            XtraMessageBox.Show("Invalid", "", MessageBoxButtons.OK, MessageBoxIcon.Hand)
            Exit Sub
        ElseIf timeEnd1.EditValue < timeEnd.EditValue Then
            XtraMessageBox.Show("Invalid", "", MessageBoxButtons.OK, MessageBoxIcon.Hand)
            Exit Sub
        End If


    End Sub
Private子测试\u单击(ByVal发送方作为System.Object,ByVal e作为System.EventArgs)
如果timeStart.EditValue>timeEnd.EditValue,则
显示(“时间结束必须高于时间开始”,“MessageBoxButtons.OK,MessageBoxIcon.Hand”)
出口接头
ElseIf timeStart.EditValue=timeEnd.EditValue然后
XtraMessageBox.Show(“时间开始不得等于时间结束”,“”,MessageBoxButtons.OK,MessageBoxIcon.Hand)
出口接头
ElseIf timeStart1.EditValue
Dim t1Start=timeStart.EditValue
Dim t1End=timeEnd.EditValue
Dim t2Start=timeStart1.EditValue
尺寸t2End=timeEnd1.EditValue

如果(t2Start>=t1Start和t2Start=t1Start和t2End=t2Start和t1Start我建议您将控件重命名为
timeStart1
timeEnd1
timeStart2
timeEnd2
。我会使用更具描述性的
firstscheduleTimeststart
firstScheduleTimeEnd
secondscheduleTimeststart
secondScheduleTimeEnd
Dim t1Start = timeStart.EditValue
Dim t1End = timeEnd.EditValue
Dim t2Start = timeStart1.EditValue
Dim t2End = timeEnd1.EditValue

If (t2Start >= t1Start And t2Start <= t1End) Or _
    (t2End >= t1Start And t2End <= t1End) Or _
    (t1Start >= t2Start And t1Start <= t2End) Then

    XtraMessageBox.Show("The times should not overlap", "", MessageBoxButtons.OK, MessageBoxIcon.Hand)

End If
1st range   <------->      <------->   <------->   <------->
2nd range       <----->  <----->        <----->   <--------->