You are on page 1of 3

Public Class Form1

Sub combo()
With ComboBoxPAwal
.Items.Add("km")
.Items.Add("hm")
.Items.Add("dam")
.Items.Add("m")
.Items.Add("dm")
.Items.Add("cm")
.Items.Add("mm")
End With
With ComboBoxPAkhir
.Items.Add("km")
.Items.Add("hm")
.Items.Add("dam")
.Items.Add("m")
.Items.Add("dm")
.Items.Add("cm")
.Items.Add("mm")
End With
End Sub

Private Sub BtnConvert_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BtnConvert.Click
If ComboBoxPAwal.Text = "km" And ComboBoxPAkhir.Text = "km" Then
TxtPOutput.Text = TxtPInput.Text
ElseIf ComboBoxPAwal.Text = "km" And ComboBoxPAkhir.Text = "hm" Then
TxtPOutput.Text = TxtPInput.Text * 10
ElseIf ComboBoxPAwal.Text = "km" And ComboBoxPAkhir.Text = "dam" Then
TxtPOutput.Text = TxtPInput.Text * 100
ElseIf ComboBoxPAwal.Text = "km" And ComboBoxPAkhir.Text = "m" Then
TxtPOutput.Text = TxtPInput.Text * 1000
ElseIf ComboBoxPAwal.Text = "km" And ComboBoxPAkhir.Text = "dm" Then
TxtPOutput.Text = TxtPInput.Text * 10000
ElseIf ComboBoxPAwal.Text = "km" And ComboBoxPAkhir.Text = "cm" Then
TxtPOutput.Text = TxtPInput.Text * 100000
ElseIf ComboBoxPAwal.Text = "km" And ComboBoxPAkhir.Text = "mm" Then
TxtPOutput.Text = TxtPInput.Text * 1000000
End If

If ComboBoxPAwal.Text = "hm" And ComboBoxPAkhir.Text = "km" Then


TxtPOutput.Text = TxtPInput.Text / 10
ElseIf ComboBoxPAwal.Text = "hm" And ComboBoxPAkhir.Text = "hm" Then
TxtPOutput.Text = TxtPInput.Text
ElseIf ComboBoxPAwal.Text = "hm" And ComboBoxPAkhir.Text = "dam" Then
TxtPOutput.Text = TxtPInput.Text * 10
ElseIf ComboBoxPAwal.Text = "hm" And ComboBoxPAkhir.Text = "m" Then
TxtPOutput.Text = TxtPInput.Text * 100
ElseIf ComboBoxPAwal.Text = "hm" And ComboBoxPAkhir.Text = "dm" Then
TxtPOutput.Text = TxtPInput.Text * 1000
ElseIf ComboBoxPAwal.Text = "hm" And ComboBoxPAkhir.Text = "cm" Then
TxtPOutput.Text = TxtPInput.Text * 10000
ElseIf ComboBoxPAwal.Text = "hm" And ComboBoxPAkhir.Text = "mm" Then
TxtPOutput.Text = TxtPInput.Text * 100000
End If
If ComboBoxPAwal.Text = "dam" And ComboBoxPAkhir.Text = "km" Then
TxtPOutput.Text = TxtPInput.Text / 100
ElseIf ComboBoxPAwal.Text = "dam" And ComboBoxPAkhir.Text = "hm" Then
TxtPOutput.Text = TxtPInput.Text / 10
ElseIf ComboBoxPAwal.Text = "dam" And ComboBoxPAkhir.Text = "dam" Then
TxtPOutput.Text = TxtPInput.Text
ElseIf ComboBoxPAwal.Text = "dam" And ComboBoxPAkhir.Text = "m" Then
TxtPOutput.Text = TxtPInput.Text * 10
ElseIf ComboBoxPAwal.Text = "dam" And ComboBoxPAkhir.Text = "dm" Then
TxtPOutput.Text = TxtPInput.Text * 100
ElseIf ComboBoxPAwal.Text = "dam" And ComboBoxPAkhir.Text = "cm" Then
TxtPOutput.Text = TxtPInput.Text * 1000
ElseIf ComboBoxPAwal.Text = "dam" And ComboBoxPAkhir.Text = "mm" Then
TxtPOutput.Text = TxtPInput.Text * 10000
End If

If ComboBoxPAwal.Text = "m" And ComboBoxPAkhir.Text = "km" Then


TxtPOutput.Text = TxtPInput.Text / 1000
ElseIf ComboBoxPAwal.Text = "m" And ComboBoxPAkhir.Text = "hm" Then
TxtPOutput.Text = TxtPInput.Text / 100
ElseIf ComboBoxPAwal.Text = "m" And ComboBoxPAkhir.Text = "dam" Then
TxtPOutput.Text = TxtPInput.Text / 10
ElseIf ComboBoxPAwal.Text = "m" And ComboBoxPAkhir.Text = "m" Then
TxtPOutput.Text = TxtPInput.Text
ElseIf ComboBoxPAwal.Text = "m" And ComboBoxPAkhir.Text = "dm" Then
TxtPOutput.Text = TxtPInput.Text * 10
ElseIf ComboBoxPAwal.Text = "m" And ComboBoxPAkhir.Text = "cm" Then
TxtPOutput.Text = TxtPInput.Text * 100
ElseIf ComboBoxPAwal.Text = "m" And ComboBoxPAkhir.Text = "mm" Then
TxtPOutput.Text = TxtPInput.Text * 1000
End If

If ComboBoxPAwal.Text = "dm" And ComboBoxPAkhir.Text = "km" Then


TxtPOutput.Text = TxtPInput.Text / 10000
ElseIf ComboBoxPAwal.Text = "dm" And ComboBoxPAkhir.Text = "hm" Then
TxtPOutput.Text = TxtPInput.Text / 1000
ElseIf ComboBoxPAwal.Text = "dm" And ComboBoxPAkhir.Text = "dam" Then
TxtPOutput.Text = TxtPInput.Text / 100
ElseIf ComboBoxPAwal.Text = "dm" And ComboBoxPAkhir.Text = "m" Then
TxtPOutput.Text = TxtPInput.Text / 10
ElseIf ComboBoxPAwal.Text = "dm" And ComboBoxPAkhir.Text = "dm" Then
TxtPOutput.Text = TxtPInput.Text
ElseIf ComboBoxPAwal.Text = "dm" And ComboBoxPAkhir.Text = "cm" Then
TxtPOutput.Text = TxtPInput.Text * 10
ElseIf ComboBoxPAwal.Text = "dm" And ComboBoxPAkhir.Text = "mm" Then
TxtPOutput.Text = TxtPInput.Text * 100
End If

If ComboBoxPAwal.Text = "cm" And ComboBoxPAkhir.Text = "km" Then


TxtPOutput.Text = TxtPInput.Text / 1000
ElseIf ComboBoxPAwal.Text = "cm" And ComboBoxPAkhir.Text = "hm" Then
TxtPOutput.Text = TxtPInput.Text / 100
ElseIf ComboBoxPAwal.Text = "cm" And ComboBoxPAkhir.Text = "dam" Then
TxtPOutput.Text = TxtPInput.Text / 10
ElseIf ComboBoxPAwal.Text = "cm" And ComboBoxPAkhir.Text = "m" Then
TxtPOutput.Text = TxtPInput.Text
ElseIf ComboBoxPAwal.Text = "cm" And ComboBoxPAkhir.Text = "dm" Then
TxtPOutput.Text = TxtPInput.Text * 10
ElseIf ComboBoxPAwal.Text = "cm" And ComboBoxPAkhir.Text = "cm" Then
TxtPOutput.Text = TxtPInput.Text * 100
ElseIf ComboBoxPAwal.Text = "cm" And ComboBoxPAkhir.Text = "mm" Then
TxtPOutput.Text = TxtPInput.Text * 1000
End If

If ComboBoxPAwal.Text = "mm" And ComboBoxPAkhir.Text = "km" Then


TxtPOutput.Text = TxtPInput.Text / 1000000
ElseIf ComboBoxPAwal.Text = "mm" And ComboBoxPAkhir.Text = "hm" Then
TxtPOutput.Text = TxtPInput.Text / 100000
ElseIf ComboBoxPAwal.Text = "mm" And ComboBoxPAkhir.Text = "dam" Then
TxtPOutput.Text = TxtPInput.Text / 10000
ElseIf ComboBoxPAwal.Text = "mm" And ComboBoxPAkhir.Text = "m" Then
TxtPOutput.Text = TxtPInput.Text / 1000
ElseIf ComboBoxPAwal.Text = "mm" And ComboBoxPAkhir.Text = "dm" Then
TxtPOutput.Text = TxtPInput.Text / 100
ElseIf ComboBoxPAwal.Text = "mm" And ComboBoxPAkhir.Text = "cm" Then
TxtPOutput.Text = TxtPInput.Text / 10
ElseIf ComboBoxPAwal.Text = "mm" And ComboBoxPAkhir.Text = "mm" Then
TxtPOutput.Text = TxtPInput.Text
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
Call combo()
End Sub

End Class

Sub combo()
With ComboBoxPAwal
.Items.Add("meter")
.Items.Add("inch")
.Items.Add("feet")
.Items.Add("yard")
.Items.Add("mile")
End With
With ComboBoxPAkhir
.Items.Add("meter")
.Items.Add("inch")
.Items.Add("feet")
.Items.Add("yard")
.Items.Add("mile")
End With
End Sub

You might also like