Lichtkrant: code


Dim lichtkranttekst As String
Dim interval As Integer

Private Sub cmdSetFont_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSetFont.Click
FontDialog1.Font = lblLichtkrant.Font
FontDialog1.ShowDialog()
lblLichtkrant.Font = FontDialog1.Font
End Sub

Private Sub cmdSetText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSetText.Click
lichtkranttekst = InputBox("Welke tekst laten we verschijnen?", , lichtkranttekst)
End Sub

Private Sub cmdSetDelay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSetDelay.Click
Dim buffer As String
Do
buffer = InputBox("Welk interval moet ik gebruiken (in milliseconden)", , interval)
Loop Until IsNumeric(buffer)
interval = CInt(buffer)
Timer1.Interval = interval
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static positie As Integer
Static boodschap As String
Static letter As String
positie = positie + 1
If positie > Len(lichtkranttekst) Then 'het einde is bereikt; herbegin
positie = 1
boodschap = ""
End If
letter = Mid(lichtkranttekst, positie, 1)
boodschap = boodschap & letter
lblLichtkrant.Text = boodschap
End Sub


[VB Web] - [hlrnet] - [copyright]