I want the timer to set the interval in hours or minutes and not in milliseconds.
I get the following error when I set the interval as in minute as Timer1.Interval = 60000 * 5
"Run-time error 380, Invalid Property Value"
Sorry dude, but the regular timer cannot take values larger than 65535 ms. So my advise, you can try Long Timer, a freeware program. The link is here
Just scroll down to the download link. Hope this helps.
^ Thanx lalo, u rock :)
Do you know there is a BUG in the Long Timer, please download the attachment and see for youself :)
try using globals parameteres for Hours and Minutes and seconds
global g_Hour as integer global g_Minute as integer global g_Seconds as integer
Set the timer for 1000 ( one seccond )
Private Sub Timer1_Timer() Dim mySeconds As Integer Dim MyMinutes As Integer Dim MyHours As Integer mySeconds = 21 MyMinutes = 9 MyHours = 2 If g_seconds >= 60 Then g_minute = g_minute + 1 g_seconds = 0 If g_minutes >= 60 Then g_hours = g_hours + 1 g_minutes = 0 End If End If If g_hours = MyHours Then If g_minutes = MyMinutes Then If g_seconds = mySeconds Then 'Action would happen Here End If End If End If End Sub
That should work or be pretty close.
I forgot to increment g_seconds. here it is again, working this time.
Private Sub Timer1_Timer() Dim mySeconds As Integer Dim MyMinutes As Integer Dim MyHours As Integer mySeconds = 11 MyMinutes = 0 MyHours = 0 g_seconds = g_seconds + 1 If g_seconds >= 60 Then g_minutes = g_minutes + 1 g_seconds = 0 If g_minutes >= 60 Then g_Hours = g_Hours + 1 g_minutes = 0 End If End If If g_Hours = MyHours Then If g_minutes = MyMinutes Then If g_seconds = mySeconds Then 'Action would happen Here MsgBox "Done" g_seconds = 0 g_minutes = 0 g_Hours = 0 End If End If End If Label1.Caption = g_Hours & ":" & g_minutes & ":" & g_seconds End Sub
I would suggest setting your timer to 60 seconds (1 minute) OR every second. Then keep a variable that gets incremented as the timer fires. Then you can check it for the time in question, and fire it accordingly.
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Private Sub btn_addline_Click(ByVal ...
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...