Senin, 23 Maret 2020

Visual Lanjutan TEORI 2 Latihan 2 (Percabangan IF)

Public Class Form1

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged

        If ComboBox1.Text = "Garuda" Then

            If ComboBox2.Text = "JAKARTA-PONTIANAK" Then

                TextBox1.Text = 500000

            ElseIf ComboBox2.Text = "JAKARTA-BALI" Then

                TextBox1.Text = 1000000

            ElseIf ComboBox2.Text = "JAKARTA-MANADO" Then

                TextBox1.Text = 1500000

            End If

        ElseIf ComboBox1.Text = "Lion Air" Then

            If ComboBox2.Text = "JAKARTA-PONTIANAK" Then

                TextBox1.Text = 300000

            ElseIf ComboBox2.Text = "JAKARTA-BALI" Then

                TextBox1.Text = 600000

            ElseIf ComboBox2.Text = "JAKARTA-MANADO" Then

                TextBox1.Text = 800000

            End If

        ElseIf ComboBox1.Text = "Sriwijaya" Then

            If ComboBox2.Text = "JAKARTA-PONTIANAK" Then

                TextBox1.Text = 400000

            ElseIf ComboBox2.Text = "JAKARTA-BALI" Then

                TextBox1.Text = 800000

            ElseIf ComboBox2.Text = "JAKARTA-MANADO" Then

                TextBox1.Text = 1000000



            End If

        End If

    End Sub



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        ComboBox1.Text = ""

        ComboBox2.Text = ""

        TextBox1.Text = ""

    End Sub



    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim pesan As String

        pesan = MsgBox("Yakin Mau Keluar ??", vbYesNo, "Konfirmasi")

        If pesan = vbYes Then

            Close()

            End

        End If

    End Sub

End Class

Tidak ada komentar:

Posting Komentar