vb converter example
vb code is:-
Private Sub cmdChangeOunceGram_Click()
Call cmdClearOunceGram_Click
If Label5.Caption = "Ounce" Then
Label5.Caption = "Gram"
Label6.Caption = "Ounce"
Else
Label5.Caption = "Ounce"
Label6.Caption = "Gram"
End If
End Sub
Private Sub cmdClearPoundKilo_Click()
text1.Text = ""
text2.Text = ""
End Sub
Private Sub cmdChangePoundKilo_Click()
Call cmdClearPoundKilo_Click
If Label1.Caption = "Pound" Then
Label1.Caption = "Kilogram"
Label2.Caption = "Pound"
Else
Label1.Caption = "Pound"
Label2.Caption = "Kilogram"
End If
End Sub
Private Sub cmdClearCaratGram_Click()
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub cmdChangeCaratGram_Click()
Call cmdClearCaratGram_Click
If Label3.Caption = "Carat" Then
Label3.Caption = "Gram"
Label4.Caption = "Carat"
Else
Label3.Caption = "Carat"
Label4.Caption = "Gram"
End If
End Sub
Private Sub cmdClearOunceGram_Click()
Text5.Text = ""
Text6.Text = ""
End Sub
Private Sub cmdPoundKilo_Click()
fraPoundKilo.Visible = True
fraCaratGram.Visible = False
fraOunceGram.Visible = False
End Sub
Private Sub cmdCaratGram_Click()
fraCaratGram.Visible = True
fraOunceGram.Visible = False
fraPoundKilo.Visible = False
End Sub
Private Sub cmdOunceGram_Click()
fraOunceGram.Visible = True
fraPoundKilo.Visible = False
fraCaratGram.Visible = False
End Sub
Private Sub text1_Change()
If Label1.Caption = "Pound" Then
text2.Text = Val(text1.Text) * 0.4536
Else
text2.Text = Val(text1.Text) * 2.2045855
End If
End Sub
Private Sub Text3_Change()
If Label3.Caption = "Carat" Then
Text4.Text = Val(Text3.Text) * 0.2
Else
Text4.Text = Val(Text3.Text) * 5
End If
End Sub
Private Sub Text5_Change()
If Label5.Caption = "Ounce" Then
Text6.Text = Val(Text5.Text) * 28.35
Else
Text6.Text = Val(Text5.Text) * 0.0352734
End If
End Sub
Comments
Post a Comment