Thursday, April 19, 2012

Program perhitungan rumus Fisika dengan menggunakan Visual Basic





Keterangan and Fitur :
- Program sangat sederhana (dibuat cuma 5 menit kurang)
- Cuma 1Form.
- 3 Variable (jadi paling rumus yang digunain a = b * a (dibolak balik bisa)
- Ada warning jika mau mencari a, tapi malah menginput a dan b. (salah input)
- Ada waning, jika ada orang gila nginput huruf (masa ngitung pake huruf)
- Simple, g ribet, dll.




Codiing :



Private Sub Command1_Click()
      If Trim(LenB(Text2.Text)) = 0 Then
        MsgBox "Anda harus mengisi kolom B", vbExclamation, "Warning"
        Text2.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(Text2.Text) Then
        MsgBox "Anda harus mengisi angka pada kolom B", vbExclamation, "Warning"
        Text2.Text = ""
        Text2.SetFocus
        Exit Sub
    End If
    
    If Trim(LenB(Text3.Text)) = 0 Then
        MsgBox "Anda harus mengisi kolom C", vbExclamation, "Warning"
        Text3.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(Text3.Text) Then
        MsgBox "Anda harus mengisi angka pada kolom C", vbExclamation, "Warning"
        Text3.Text = ""
        Text3.SetFocus
        Exit Sub
    End If
    Text1.Text = Text2.Text * Text3.Text
   
End Sub

Private Sub Command2_Click()
If Trim(LenB(Text1.Text)) = 0 Then
        MsgBox "Anda harus mengisi kolom A", vbExclamation, "Warning"
        Text1.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(Text1.Text) Then
        MsgBox "Anda harus mengisi angka pada kolom A", vbExclamation, "Warning"
        Text1.Text = ""
        Text1.SetFocus
        Exit Sub
    End If
    
    If Trim(LenB(Text3.Text)) = 0 Then
        MsgBox "Anda harus mengisi kolom C", vbExclamation, "Warning"
        Text3.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(Text3.Text) Then
        MsgBox "Anda harus mengisi angka pada kolom C", vbExclamation, "Warning"
        Text3.Text = ""
        Text3.SetFocus
        Exit Sub
    End If
    Text2.Text = Text1.Text / Text3.Text
End Sub

Private Sub Command3_Click()
If Trim(LenB(Text1.Text)) = 0 Then
        MsgBox "Anda harus mengisi kolom A", vbExclamation, "Warning"
        Text1.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(Text1.Text) Then
        MsgBox "Anda harus mengisi angka pada kolom A", vbExclamation, "Warning"
        Text1.Text = ""
        Text1.SetFocus
        Exit Sub
    End If
    
    If Trim(LenB(Text2.Text)) = 0 Then
        MsgBox "Anda harus mengisi kolom B", vbExclamation, "Warning"
        Text2.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(Text2.Text) Then
        MsgBox "Anda harus mengisi angka pada kolom B", vbExclamation, "Warning"
        Text2.Text = ""
        Text2.SetFocus
        Exit Sub
    End If

    Text3.Text = Text1.Text / Text2.Text
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Command5_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub

Private Sub Form_Load()
Form1.BackColor = vbRed
End Sub


Outputnya :

Semoga berguna :D

No comments:

Post a Comment