0% found this document useful (0 votes)
115 views9 pages

Program Sederhana Visal Basic 6.0 Untuk Pemula

The document contains code listings for several simple Visual Basic 6.0 programs for beginners. It includes code for forms that demonstrate password login, text scrolling, color changing, and basic math operations like addition, subtraction, multiplication and division.

Uploaded by

hussein_wahab
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views9 pages

Program Sederhana Visal Basic 6.0 Untuk Pemula

The document contains code listings for several simple Visual Basic 6.0 programs for beginners. It includes code for forms that demonstrate password login, text scrolling, color changing, and basic math operations like addition, subtraction, multiplication and division.

Uploaded by

hussein_wahab
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

Program sederhana visal basic 6.

0 untuk pemula

Listing program:

If Text1.Text = "hussein" Then


Formpilihan.Show
Unload Me
Else
MsgBox "anda salah memasukkan password", vbCritical, Me.Caption
Text1.Text = ""
Text1.SetFocus
End If
End Sub

Private Sub Form_Load()


iTeks = 1
End Sub

Private Sub Timer1_Timer()


Pos = Pos + 1
If iTeks = 1 Then
MyTeks = "selamat datang di rumah saya"
ElseIf iTeks = 2 Then
MyTeks = "hussein abdul wahab"
ElseIf iTeks = 3 Then
MyTeks = "Dengan Visual Basic"
End If
StartPos = Len(MyTeks)
Lengh = StartPos - Pos
If Lengh = 0 Then
If iTeks = 1 Then
iTeks = 2
ElseIf iTeks = 2 Then
iTeks = 3
ElseIf iTeks = 3 Then
iTeks = 1
End If
Pos = 0 - StartPos
End If
Label1 = Right(MyTeks, Lengh)
End Sub

Form pilihan:

Listing program:

Private Sub mnuabot_Click()


Formabout.Show
Unload Me
MsgBox "tolong jangan di baca", vbCritical
End Sub
Private Sub mnucopy_Click()
MsgBox "anda menekan menu copy", vbInformation
End Sub

Private Sub mnucut_Click()


MsgBox "anda menekan menu cut", vbCritical
End Sub

Private Sub mnujumlah_Click()


formjumlah.Show
Unload Me
End Sub

Private Sub mnukali_Click()


Formkali.Show
Unload Me
End Sub

Private Sub mnupaste_Click()


MsgBox "anda menekan menu paste", vbExclamation
End Sub

Form perkalian

listing:

Private Sub

Command1_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub

Private Sub mnuback_Click()


formmasuk.Show
Unload Me
End Sub

Form pembagian:

Listing program:
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text): Val (Text2.Text)
End Sub

Private Sub mnuabot_Click()


Formtentang.Show
Unload Me
End Sub

Private Sub mnubagi_Click()


Formbagi.Show
Unload Me
End Sub

Private Sub mnujumlah_Click()


formjumlah.Show
Unload Me
End Sub

Private Sub mnukali_Click()


Formkali.Show
Unload Me
End Sub

Private Sub mnulogin_Click()


formmasuk.Show
Unload Me
End Sub

Private Sub mnupilih_Click()


Formpilihan.Show
Unload Me
End Sub

Private Sub mnuwarna_Click()


Formwarna.Show
Unload Me
End Sub

Form penjumlahan:

Listing program:
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub

Private Sub mnumasuk_Click()


formmasuk.Show
Unload Me
End Sub

Private Sub mnupilihan_Click()


Formpilihan.Show
Unload Me
End Sub

Form pembagian:

Listing:
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
End Sub

Private Sub mnupilih_Click()


Formpilihan.Show
Unload Me
End Sub
Listing program:
Dim i As Long
Dim merah, hijau, biru As Integer

Private Sub Form_Load()


i=0
Timer1.Interval = 500
End Sub

Private Sub Label2_Click()


Formpilihan.Show
Unload Me
End Sub

Private Sub Timer1_Timer()


i=i+1
If i = 1000000 Then i = 0
merah = Int(255 * Rnd)
hijau = Int(255 * Rnd)
biru = Int(255 * Rnd)
Label1.ForeColor = RGB(merah, hijau, biru)
If i Mod 2 = 0 Then
Label1.Visible = True
Else
Label1.Visible = False
End If
End Sub

Form warna:

Listing program;
Private Sub Command1_Click()
Formwarna.BackColor = vbRed
End Sub

Private Sub Command2_Click()


Formwarna.BackColor = vbGreen
End Sub

Private Sub Command3_Click()


Formwarna.BackColor = vbBlue
End Sub

Private Sub Command4_Click()


Formwarna.BackColor = vbYellow
End Sub

Private Sub Command5_Click()


Formwarna.BackColor = vbBlack
End Sub

Private Sub Command6_Click()


Formwarna.BackColor = vbviolet
End Sub

Form tentang:

Listing program:

Private Sub Timer1_Timer()


i=i+1
If i = 1000000 Then i = 0
merah = Int(255 * Rnd)
hijau = Int(255 * Rnd)
biru = Int(255 * Rnd)
Label1.ForeColor = RGB(merah, hijau, biru)
If i Mod 2 = 0 Then
Label1.Visible = True
Else
Label1.Visible = False
End If
End Sub

You might also like