Weight Converter


The weight converter program is written in VB6.

The Weight Converter program converts from one weight unit to another like pound to kilogram, carat to gram and so on.  It has a simple menu (not like menu bar).

                                                >> DOWNLOAD

                                                                                           

Screenshot:
Converting from one weight unit to another


Code:

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