Rabu, 13 November 2013

Program menghitung lingkarang menggunakan visual besic


     A. Tampilan Form

a.     B. Listing

Private Sub Command1_Click()
phi = 3.14
R = Val(Text1.Text)
luas = phi * R * 2
Keliling = phi * R ^ 2
Text2.Text = luas
Text3.Text = Keliling
End Sub

Private Sub Command2_Click()
Text1.Text = Clear
Text2.Text = Clear
Text3.Text = Clear
End Sub

Program penjumlahan menggunakan visual besic



1.      Tampilan Form


 
a.      Listing

Private Sub Command1_Click()
Text3 = Val(Text1.Text) + Val(Text2.Text)
MsgBox "Hasil Penjumlahan adalah " & Text3, vbOKOnly, "Pesan"
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Program Membuat Menu Makanan menggunakan Visual Besic



      A. Tampilan form

     B. Listing

Private Sub Option1_Click()
 If Option1.Value = True Then
   Label1.Caption = "Soto Ayam"

   End If
End Sub

Private Sub Option2_Click()
 If Option2.Value = True Then
   Label1.Caption = "Rawon"

   End If
End Sub

Private Sub Option3_Click()
If Option3.Value = True Then
   Label1.Caption = "Gado-Gado"

   End If
End Sub

Private Sub Option4_Click()
If Option4.Value = True Then
   Label1.Caption = " Krengsengan"

   End If
End Sub

Private Sub Option5_Click()
If Option5.Value = True Then
   Label1.Caption = "Pecel Mediun"

   End If
End Sub

Private Sub Option6_Click()
If Option6.Value = True Then
   Label2.Caption = "Teh Manis"
   End If
End Sub

Private Sub Option7_Click()
If Option7.Value = True Then
   Label2.Caption = "ES Teh"

   End If
End Sub

Private Sub Option8_Click()
If Option8.Value = True Then
   Label2.Caption = "ES Jeruk"

   End If
End Sub

Private Sub Option9_Click()
If Option9.Value = True Then
   Label2.Caption = "Kopi"

   End If
End Sub