0% found this document useful (0 votes)
29 views

G12-Ict Programming - Output8problem # 12

The document describes a program that converts between different measurement units. The program includes: - Controls like labels, textboxes, buttons, and radio buttons to select the conversion type - Code to convert between Celsius and Fahrenheit, kilometers and meters, grams and kilograms, and other units - A button to perform the conversion based on the selected radio button option - A button to reset the fields and clear the output

Uploaded by

Francis
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

G12-Ict Programming - Output8problem # 12

The document describes a program that converts between different measurement units. The program includes: - Controls like labels, textboxes, buttons, and radio buttons to select the conversion type - Code to convert between Celsius and Fahrenheit, kilometers and meters, grams and kilograms, and other units - A button to perform the conversion based on the selected radio button option - A button to reset the fields and clear the output

Uploaded by

Francis
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

QUARTER 3

Subject Programming (Specialized)


Garde & Strand: 12-ICT Programming (TVL)
Name: Francis Hadriel B. Pomida

LAS 2 – Activity 2 –no3(Problem#12)

PROBLEM # 12:
a.) Write a program that converts measurements (meter to centimeter, foot to inches, Fahrenheit to
Celsius, etc). Your program's GUI should contain basic controls such as label, textbox, and a button.

b.) Extend functionality and features of your basic program by adding additional controls such as
RadioButtons, Checkboxes, and Menus to your program.

OUTPUT # 12:
Public Class Form1
Dim celsius, Fahrenheit, Kelven As Double
Dim Kilo, Liter, Mililiter, Gram, Centimiter As Double
Dim Kilometer, Meter, Inches, Feet As Double
Dim Univert As String

Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles


radCF.CheckedChanged
Univert = "Cf"
End Sub

Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles


radFC.CheckedChanged
Univert = "Fc"
End Sub

Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles


radK.CheckedChanged
Univert = "K"
End Sub

Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles


radKG.CheckedChanged
Univert = "Kg"
End Sub

Private Sub RadioButton5_CheckedChanged(sender As Object, e As EventArgs) Handles


radGK.CheckedChanged
Univert = "Gk"
End Sub

Private Sub RadioButton6_CheckedChanged(sender As Object, e As EventArgs) Handles


radLM.CheckedChanged
Univert = "Lm"
End Sub

Private Sub RadioButton7_CheckedChanged(sender As Object, e As EventArgs) Handles


radML.CheckedChanged
Univert = "Ml"
End Sub

Private Sub RadioButton8_CheckedChanged(sender As Object, e As EventArgs) Handles


radKM.CheckedChanged
Univert = "Km"
End Sub

Private Sub RadioButton9_CheckedChanged(sender As Object, e As EventArgs) Handles


radMK.CheckedChanged
Univert = "Mk"
End Sub

Private Sub RadioButton10_CheckedChanged(sender As Object, e As EventArgs) Handles


radMF.CheckedChanged
Univert = "Mf"
End Sub

Private Sub RadioButton11_CheckedChanged(sender As Object, e As EventArgs) Handles


radFI.CheckedChanged
Univert = "Fi"
End Sub

Private Sub RadioButton12_CheckedChanged(sender As Object, e As EventArgs) Handles


radCM.CheckedChanged
Univert = "Cm"
End Sub

Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles


btnConvert.Click
Select Case (Univert)
Case "Cf"
'Celsius to Fahrenhiet'
celsius = Double.Parse(TextBox1.Text)
lbl12.Text = ((((9 * celsius) / 5) + 32).ToString())

Case "Fc"
'Fahrenhiet to Celsius'
Fahrenheit = Double.Parse(TextBox1.Text)
lbl12.Text = ((((Fahrenheit - 32) * 5) / 9).ToString())

Case "K"
'Convert to Kelvin'
Kelven = Double.Parse(TextBox1.Text)
lbl12.Text = (((((9 * Kelven) / 5) + 32) + 273.15).ToString())

Case "Kg"
'Kilogram to Gram'
Kilo = Double.Parse(TextBox1.Text)
lbl12.Text = ((1000 * Kilo).ToString())

Case "Gk"
'Gram to Kilogram'
Gram = Double.Parse(TextBox1.Text)
lbl12.Text = ((Gram / 1000).ToString())

Case "Lm"
'Liter to Mililiter'
Liter = Double.Parse(TextBox1.Text)
lbl12.Text = ((1000 * Liter).ToString())

Case "Ml"
'Mililiter to Liter'
Mililiter = Double.Parse(TextBox1.Text)
lbl12.Text = ((Mililiter / Kilometer).ToString())

Case "Km"
'Kilometer to Meter'
Kilometer = Double.Parse(TextBox1.Text)
lbl12.Text = ((1000 * Kilometer).ToString())

Case "Mk"
'Meter to Kilometer'
Meter = Double.Parse(TextBox1.Text)
lbl12.Text = ((Meter / 1000).ToString())

Case "Mf"
'Meter to Feet'
Inches = Double.Parse(TextBox1.Text)
lbl12.Text = ((3 * Inches).ToString())

Case "Fi"
'Feet to Inches'
Feet = Double.Parse(TextBox1.Text)
lbl12.Text = ((Feet * 12).ToString())

Case "Cm"
'Centimeter to Meter'
Centimiter = Double.Parse(TextBox1.Text)
lbl12.Text = ((Centimiter / 100).ToString())
End Select
End Sub

Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click


TextBox1.Clear()
lbl12.Text = ""
radCF.Checked = False
radK.Checked = False
radFC.Checked = False
radKG.Checked = False
radGK.Checked = False
radLM.Checked = False
radML.Checked = False
radKM.Checked = False
radMK.Checked = False
radMF.Checked = False
radFI.Checked = False
End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click


Me.Close()
End Sub
End Class

You might also like