VB6 Example for Temperature degrees conversion!
Example: Write VB6 program Code to Convert Temperature Degrees from Celsius to Fahrenheit and vice verse using the following design. Notice that the conversion formulas are represented as an Image that will be visible only when conversion command buttons are being clicked, also a Reset button is used to reset values and make image invisible again?
Solution:
Private Sub Command1_Click()
C = Val(Text1.Text)
F = C * (9 / 5) + 32
Label2.Caption = F
Image1.Visible = True
End Sub
Private Sub Command2_Click()
F = Val(Text1.Text)
C = (F - 32) * (5 / 9)
Label3.Caption = C
Image1.Visible = True
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Label2.Caption = ""
Label3.Caption = ""
Image1.Visible = False
End Sub
C = Val(Text1.Text)
F = C * (9 / 5) + 32
Label2.Caption = F
Image1.Visible = True
End Sub
Private Sub Command2_Click()
F = Val(Text1.Text)
C = (F - 32) * (5 / 9)
Label3.Caption = C
Image1.Visible = True
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Label2.Caption = ""
Label3.Caption = ""
Image1.Visible = False
End Sub


0 Comments:
Post a Comment
السلام عليكم...سارد بعد قرائتي للتعليق...شكرا
<< Home