Hi All,

iam having a timer in my application and want it to be enabled based on the time pollings that are read from config file like below :

<appSettings>
<add key ="PollBetweenTime" value ="06:10-07:10;19:00-20:00"/>
<add key ="PollInterval" value ="10000"/>
</appSettings>
Here The pollingbetweentime indicates the time that the timer should be enabled like it should start at 6:10 and stop at 7:10 and again should start at 19:00 and stop at 20:00
please send me the code for this. Iam new to VB.net

Hi All,
Iam trying with the code like this, could you please guide me from here

Dim pollBetweenTime As String = My.Settings.PollBetweenTime
Dim intervals As String() = pollBetweenTime.Split(";"c)
Dim subIntervals As String() = intervals(0).Split("-"c)
Dim startDate1 As DateTime = DateTime.Parse(subIntervals(0))
Dim endDate1 As DateTime = DateTime.Parse(subIntervals(1))
subIntervals = intervals(1).Split("-"c)
Dim startDate2 As DateTime = DateTime.Parse(subIntervals(0))
Dim endDate2 As DateTime = DateTime.Parse(subIntervals(1))

From your description I assume that you are thinking this wrong. What you need to do is create a timer with PollInterval as period and every time is runs you need to check if current time is within the periods specified in PollBetweenTime.

Let me know how this works out for you.

Hi Adam,
Thanks for your support and quick reply , i need exactly the timer to work same as u said, could guide me or provide some code on the same.
That could be a great help for me
Thanks

This article has been dead for over six months. Start a new discussion instead.