Home > Visual Basic 6 > Kalimat Berjalan Pada Label di Form

Kalimat Berjalan Pada Label di Form

Contoh source code berikut untuk membuat kalimat berjalan pada label di form.

Yang diperlukan :
1 Form
1 Timer (set interval = 100)
1 Label

Source code pada Form :

Dim counter As Integer

Private Sub Timer1_Timer()
    Dim Kalimat As String
    Kalimat = "Ini adalah contoh kalimat berjalan"
    counter = counter + 1
    DoEvents
    Label1.Caption = TulisJalan(counter, Kalimat, 30)
End Sub

Public Function TulisJalan(hitung As Integer, strKalimat As String, _
                           Panjang As Integer)
  If hitung = Len(strKalimat) + Panjang Then
     hitung = 0
  ElseIf hitung > Len(strKalimat) Then
     TulisJalan = strKalimat & Space(hitung - Len(strKalimat))
  Else
     TulisJalan = Mid(strKalimat, 1, hitung)
  End If
End Function

Download Source Code

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: