Write an event procedure to convert the Fahrenheit temperature to Centigrade. Use a Horizontal scroll bar to select the Fahrenheit temperature.
Celsius=(Fahrenheit-32)*0.555
Refer Temperature Conversion also.
Celsius=(Fahrenheit-32)*0.555
Refer Temperature Conversion also.
A) Program Design :
(B) Property(Controls Used) :
- 4 Labels Captions as : Fahrenheit(Name Label1), Celcius(Name Label2), 0(Name lbl_cel), 0(Name lbl_Fah) brespectively.
- HorizontalScrollBar : Min-0,Max100,Large Change 5 , Name-Hscr_fah
(C) Attaching Code to the Object :
Private Sub Form_Load() Hscr_Fah_Change End Sub |
Private Sub HScr_Fah_Change() lbl_Fah.Caption = Hscr_Fah.Value lbl_Cel.Caption = (Hscr_Fah - 32) * 0.555 End Sub |
(C) Result :
Moving the ScrollBar will show the temperature in both degrees (from 0-100)
==================================================================
No comments:
Post a Comment