Kamis, 02 Mei 2013

VB 2008_Membuat Aplikasi Translator Bahasa

Posted by Unknown | 13.37 Categories:

Membuat aplikasi translator bahasa (selamat pagi, selamat siang, selamat malam, selamat ulang tahun, makan, minum, dll) Indonesia-Inggris, Indonesia-Jepang, Indonesia-Cina, Indonesia-Korea, Indonesia-Jerman, Indonesia-Perancis dengan menggunakan fungsi select case.
1.         Buat project baru, pilih template windows application,kemudian click OK.
2.         Tambahkan kontrol-kontrol berikut:
Kontrol
Properti
Nilai
GroupBox1
Nama
GroupBox1

Text
Translator Bahasa
RadioButton1
Nama
RadioButton1

Text
Indonesia-Inggris
RadioButton2
Nama
RadioButton2

Text
Indonesia-Jepang
RadioButton3
Nama
RadioButton3

Text
Indonesia-Cina
RadioButton4
Nama
RadioButton4

Text
Indonesia-Korea
RadioButton5
Nama
RadioButton5

Text
Indonesia-Jerman
RadioButton6
Nama
RadioButton6

Text
Indonesia-Perancis
GroupBox2
Nama
GroupBox2

Text
Kosa Kata
ComboBox1
Nama
ComboBox1

Text
-
Button1
Nama
Button1

Text
Translate
TextBox1
Nama
TextBox1

Text
-

Syntax:
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("Selamat pagi")
        ComboBox1.Items.Add("Selamat siang")
        ComboBox1.Items.Add("Selamat malam")
        ComboBox1.Items.Add("Selamat Ulang Tahun")
        ComboBox1.Items.Add("Selamat makan")
        ComboBox1.Items.Add("Selamat minum")
        ComboBox1.Items.Add("Terima kasih")


    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim KosaKata As String = CStr(ComboBox1.Text)
        Select Case KosaKata
            Case "Selamat pagi"
                If RadioButton1.Checked Then
                    TextBox1.Text = "Good Morning"
                ElseIf RadioButton2.Checked Then
                    TextBox1.Text = "Ohayogozaimasu "
                ElseIf RadioButton3.Checked Then
                    TextBox1.Text = "Zao an"
                ElseIf RadioButton4.Checked Then
                    TextBox1.Text = "guten Morgen"
                ElseIf RadioButton5.Checked Then
                    TextBox1.Text = "joh-eun achim"
                ElseIf RadioButton6.Checked Then
                    TextBox1.Text = "bonjour"

                End If
            Case "Selamat siang"
                If RadioButton1.Checked Then
                    TextBox1.Text = "good afternoon"
                ElseIf RadioButton2.Checked Then
                    TextBox1.Text = "Kon'nichiwa"
                ElseIf RadioButton3.Checked Then
                    TextBox1.Text = "Xiàwu hao"
                ElseIf RadioButton4.Checked Then
                    TextBox1.Text = "guten Tag"
                ElseIf RadioButton5.Checked Then
                    TextBox1.Text = "annyeonghaseyo"
                ElseIf RadioButton6.Checked Then
                    TextBox1.Text = "bonjour"
                End If

            Case "Selamat malam"
                If RadioButton1.Checked Then
                    TextBox1.Text = "good evening"
                ElseIf RadioButton2.Checked Then
                    TextBox1.Text = "Konbanwa "
                ElseIf RadioButton3.Checked Then
                    TextBox1.Text = "Wanshàng hao"
                ElseIf RadioButton4.Checked Then
                    TextBox1.Text = "guten Abend"
                ElseIf RadioButton5.Checked Then
                    TextBox1.Text = "annyeonghaseyo"
                ElseIf RadioButton6.Checked Then
                    TextBox1.Text = "bonsoir"
                End If
            Case "Selamat ulang tahun"

                If RadioButton1.Checked Then
                    TextBox1.Text = "happy birthday"
                ElseIf RadioButton2.Checked Then
                    TextBox1.Text = "Otanjobiomedetogozaimasu"
                ElseIf RadioButton3.Checked Then
                    TextBox1.Text = "Zhù ni shengrì kuàilè"
                ElseIf RadioButton4.Checked Then
                    TextBox1.Text = "Happy Birthday"
                ElseIf RadioButton5.Checked Then
                    TextBox1.Text = "saeng-il"
                ElseIf RadioButton6.Checked Then
                    TextBox1.Text = "joyeux anniversaire"
                End If
            Case "Selamat makan"
                If RadioButton1.Checked Then
                    TextBox1.Text = "bon appetite"
                ElseIf RadioButton2.Checked Then
                    TextBox1.Text = "Meshiagare "
                ElseIf RadioButton3.Checked Then
                    TextBox1.Text = "Zhù nín hao wèikou"
                ElseIf RadioButton4.Checked Then
                    TextBox1.Text = "Guten Appetit"
                ElseIf RadioButton5.Checked Then
                    TextBox1.Text = "mas-issge deuseyo"
                ElseIf RadioButton6.Checked Then
                    TextBox1.Text = "bon appétit"
                End If
            Case "Selamat minum"

                If RadioButton1.Checked Then
                    TextBox1.Text = "bottoms up"
                ElseIf RadioButton2.Checked Then
                    TextBox1.Text = "Botomuappu"
                ElseIf RadioButton3.Checked Then
                    TextBox1.Text = "Ganbei"
                ElseIf RadioButton4.Checked Then
                    TextBox1.Text = "Bottoms Up"
                ElseIf RadioButton5.Checked Then
                    TextBox1.Text = "choedae bada"
                ElseIf RadioButton6.Checked Then
                    TextBox1.Text = "bottoms up"
                End If
            Case "Terima kasih"

                If RadioButton1.Checked Then
                    TextBox1.Text = "Thank you"
                ElseIf RadioButton2.Checked Then
                    TextBox1.Text = "Arigato"
                ElseIf RadioButton3.Checked Then
                    TextBox1.Text = "Xièxiè"
                ElseIf RadioButton4.Checked Then
                    TextBox1.Text = "Gamsahabnida"
                ElseIf RadioButton5.Checked Then
                    TextBox1.Text = "Danke"
                ElseIf RadioButton6.Checked Then
                    TextBox1.Text = "Merci"
                End If



        End Select
    End Sub

End Class

Output:








0 komentar:

Posting Komentar

Silahkan jika anda yang ingin komentar, namun tolong gunakan bahasa yang sopan. Atau di kosongkan bila anda tidak ingin menampilkan pesan komentar.

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube
codecademy