Thursday, July 09, 2009
SO BORED.
anyways. Here's the code for a BMI calculator in Visual Basic (relatively easy):
__________________________________________________________________
Private Sub Command1_Click()
Dim height, weight, bmi As Single
height = Text1.Textweight = Text2.Text
bmi = weight / (height * height)Text3.Text = bmi
Command2.SetFocus
End Sub
Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
End Sub
Private Sub Form_Load()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
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
; Think. Not talk.
12:03 AM