Hi All,
Sorry if I've created this query in the wrong topic, but I sure this will be an easy one for the pros.
I fairly new to VB.net, I really just teaching myself, by looking for my answers on the net. However I cannot find the answer to this query:
I am using the following code to check whether a date(s) fall into a date range.
There are could be six dates BH1, BH2, etc
Dim BH1 As Date = XmlDoc2.SelectSingleNode("B/H1").InnerText()
Dim BH2 As Date = XmlDoc2.SelectSingleNode("B/H2").InnerText()
Dim BH3 As Date = XmlDoc2.SelectSingleNode("B/H3").InnerText()
Dim BH4 As Date = XmlDoc2.SelectSingleNode("B/H4").InnerText()
Dim BH5 As Date = XmlDoc2.SelectSingleNode("B/H5").InnerText()
Dim BH6 As Date = XmlDoc2.SelectSingleNode("B/H6").InnerText()
'Loop check each date
Dim d As Integer
For d = 1 To 6
Dim chkdateNUM As Integer = 1
'Check whether theres a bank on my date range
Dim CompareDates As New List(Of Date)
CompareDates.Add(StartDate)
CompareDates.Add(EndDate)
Dim chkdate As Date = BH1
CompareDates.Sort()
If chkdate >= CompareDates(0) And chkdate <= CompareDates(1) Then
MsgBox("YES")
ElseIf chkdate = Form4.DateTimePicker3.Value Then
MsgBox("YES 2")
Else
MsgBox("NO")
End If
Next d
Call SumTotal()
Catch ex As Exception
MsgBox(ex.Message)
End Try
I've created a loop, but how do I change the Dim chkdate As Date = BH1
so it checked each date?
Thanks for your help
Sorry if I've created this query in the wrong topic, but I sure this will be an easy one for the pros.
I fairly new to VB.net, I really just teaching myself, by looking for my answers on the net. However I cannot find the answer to this query:
I am using the following code to check whether a date(s) fall into a date range.
There are could be six dates BH1, BH2, etc
Dim BH1 As Date = XmlDoc2.SelectSingleNode("B/H1").InnerText()
Dim BH2 As Date = XmlDoc2.SelectSingleNode("B/H2").InnerText()
Dim BH3 As Date = XmlDoc2.SelectSingleNode("B/H3").InnerText()
Dim BH4 As Date = XmlDoc2.SelectSingleNode("B/H4").InnerText()
Dim BH5 As Date = XmlDoc2.SelectSingleNode("B/H5").InnerText()
Dim BH6 As Date = XmlDoc2.SelectSingleNode("B/H6").InnerText()
'Loop check each date
Dim d As Integer
For d = 1 To 6
Dim chkdateNUM As Integer = 1
'Check whether theres a bank on my date range
Dim CompareDates As New List(Of Date)
CompareDates.Add(StartDate)
CompareDates.Add(EndDate)
Dim chkdate As Date = BH1
CompareDates.Sort()
If chkdate >= CompareDates(0) And chkdate <= CompareDates(1) Then
MsgBox("YES")
ElseIf chkdate = Form4.DateTimePicker3.Value Then
MsgBox("YES 2")
Else
MsgBox("NO")
End If
Next d
Call SumTotal()
Catch ex As Exception
MsgBox(ex.Message)
End Try
I've created a loop, but how do I change the Dim chkdate As Date = BH1
so it checked each date?
Thanks for your help