Kamis, 26 April 2012

Sub Menu, Perulangan, Dan Timer Menggunakan Visual Basic

Pertemuan ke 7...
Buatlah Form seperti di bawah ini..
Form1 di bawah ini Menggunakan Menu Editor.. 


Form2  di bawah ini Untuk Perulangan...



//Script code untuk Form 1::

Private Sub exit_Click()
End
End Sub

Private Sub form_1_Click()
Unload Me
Form1.Show
End Sub

Private Sub Form_Load()
Me.Width = 10
End Sub

Private Sub Timer1_Timer()
Label1.ForeColor = QBColor((Rnd) * 15)
End Sub

Private Sub Timer2_Timer()
Me.Width = Me.Width + 100
tengah
If Me.Width >= 11250 Then
Timer2.Enabled = False
tengah
End If
End Sub
Public Sub tengah()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub

// Script code untuk Form2

Private Sub Command1_Click()
List1.Clear
For i = 1 To 100
List1.AddItem "Angka : " & i
Next i
End Sub

Private Sub Command2_Click()
List1.Clear
For i = 100 To 1 Step -2
List1.AddItem "Angka : " & i
Next i
End Sub

Private Sub Command3_Click()
List1.Clear
i = Asc("A")
Do Until i > Asc("Z")
List1.AddItem "Huruf : " & Chr(i)
i = i + 1
Loop
End Sub

Private Sub Command4_Click()
List1.Clear
i = Asc("Z")
Do While i >= Asc("A")
List1.AddItem "Huruf : " & Chr(i)
i = i - 1
Loop
End Sub

Private Sub Command5_Click()
End
End Sub

Private Sub Timer1_Timer()
Label1.ForeColor = QBColor((Rnd) * 15)
List1.BackColor = QBColor((Rnd) * 15)
End Sub





Tidak ada komentar:

Posting Komentar