Minutentimer: code
- Om te starten nemen we een timer.
- De code:
Public Class MinutenTimer
Inherits System.Windows.Forms.UserControl
Private p_minuten As Integer
Private p_starttijd As Date
Public Event Timer()
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
Timer1.Interval = 1000 ' we stellen de ingebouwde timer in op 1 seconde
End Sub
'...
#End Region
Public Property minuten() As Long
Get
Return p_minuten
End Get
Set(ByVal Value As Long)
p_minuten = Value
End Set
End Property
Public Property staataan() As Boolean
Get
Return Timer1.Enabled
End Get
Set(ByVal Value As Boolean)
Timer1.Enabled = Value
p_starttijd = Now 'start nu
End Set
End Property
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If DateDiff(DateInterval.Minute, Now, p_starttijd) = p_minuten Then_
RaiseEvent Timer()
End Sub
End Class
[Controls en klassen in .NET] -
[VB Web] - [hlrnet]
- [copyright]