kubaat.files.wordpress.com · web viewberikut ini adalah penjelasan coding dari program kamus...
TRANSCRIPT
APLIKASI CONVERTER SUHU
No Komponen Properties Nilai1 Form Name Konversi
Text Aplikasi Konversi Suhu Dunia2 Label Text Konversi Desimal dan Biner
Text Nilai3 Textbox1 Name txtsuhu
Text4 Textbox2 Name txtcelcius
Text3 Textbox3 Name txtreamur
Text4 Textbox4 Name txtfahrenheit
Text4 Textbox5 Name txtkelvin
Text
5 RadioButton1 Name rbcelciusText Celcius
6 RadioButton2 Name rbreamurText Reamur
5 RadioButton3 Name rbfahrenheitText Fahrenheit
6 RadioButton4 Name rbkelvinText Kelvin
7 Button1 Name CmdconvertText &Convert
8 Button2 Name CmdexitText &Exit
Public Class Konversi Dim response As MsgBoxResult 'tipe data tidak dideklarasikan dan otomatis menjadi tipe data variant
Private Sub cmdconvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdconvert.Click If rbcelcius.Checked Then txtcelcius.Text = txtsuhu.Text * 1 txtreamur.Text = 4 / 5 * txtsuhu.Text txtkelvin.Text = 273 + txtsuhu.Text txtfahrenheit.Text = 32 + (9 / 5 * txtsuhu.Text) ElseIf rbreamur.Checked Then txtcelcius.Text = 5 / 4 * txtsuhu.Text txtreamur.Text = txtsuhu.Text * 1 txtkelvin.Text = 273 + (5 / 4 * txtsuhu.Text) txtfahrenheit.Text = 32 + (9 / 4 * txtsuhu.Text) ElseIf rbkelvin.Checked Then txtcelcius.Text = txtsuhu.Text - 273 txtreamur.Text = 4 / 5 * (txtsuhu.Text - 273) txtkelvin.Text = txtsuhu.Text * 1 txtfahrenheit.Text = 32 + (9 / 5 * (txtsuhu.Text - 273)) ElseIf rbfahrenheit.Checked Then txtcelcius.Text = 5 / 9 * (txtsuhu.Text - 32) txtreamur.Text = 4 / 9 * (txtsuhu.Text - 32) txtkelvin.Text = 273 + (5 / 9 * (txtsuhu.Text - 32)) txtfahrenheit.Text = txtsuhu.Text * 1 End If End Sub
Private Sub cmdexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.Click response = MsgBox("Apakah Anda yakin ingin keluar", MsgBoxStyle.OkCancel, "Konfirmasi Keluar") If response = MsgBoxResult.Ok Then End End If
End SubEnd Class
APLIKASI PENGHITUNG JUMLAH KARAKTER
No Komponen Properties Nilai1 Form Name Form1
Text Penghitung Jumlah Karakter2 Label Text Jumlah Karakter =
Text 03 Textbox1 Name karakter
Text5 Button1 Name Btnexit
Text &Exit
Kode Program
Public Class Form1 Dim konfirmasi As MsgBoxResult
Private Sub inputkarakter_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles inputkarakter.TextChanged Label1.Text = Len(inputkarakter.Text) End Sub
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click konfirmasi = MsgBox("Anda Yakin Ingin Keluar ???", MsgBoxStyle.OkCancel, "Konfirmasi permintaan") If konfirmasi = MsgBoxResult.Ok Then End Else inputkarakter.Text = "" End If End SubEnd Class
APLIKASI KAMUS SEDERHANA
Berikut ini adalah penjelasan coding dari program Kamus Sederhana buatan saya dengan menggunakan Visual Basic 2008 Express Edition
No Komponen Properties Nilai1 Form Name Form1
Text Aplikasi Kamu English – Indonesian sederhana – Universitas Trunojoyo
3 Textbox1 Name txtkataText
4 Textbox2 Name txtartiText
5 RadioButton1 Name Rbeng2indText English - Indonesian
6 RadioButton2 Name Rbind2engText Indonesian - English
7 Datagrid1 Name datagridkamusText
8 Button1 Name btntranslateText &Translate
KODE PROGRAM
Public Class Form1 Private db As New DataClasses1DataContext
Private Sub terjemah() If rbeng2ind.Checked Then Try Dim eng = From tblkamus In db.tblkamus Where tblkamus.eng Like txtkata.Text Select tblkamus txtarti.Text = eng.Single.ind Catch MessageBox.Show("kosakata yang anda cari tidak ada", "Informasi") rbeng2ind.Focus() End Try ElseIf rbind2eng.Checked Then Try Dim ind = From tblkamus In db.tblkamus Where tblkamus.ind Like txtkata.Text Select tblkamus txtarti.Text = ind.Single.eng Catch MessageBox.Show("kosakata yang anda cari tidak ada", "Informasi") rbind2eng.Focus() End Try End If End Sub Private Sub btntranslate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntranslate.Click terjemah() End Sub
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated Dim grideng = From tblkamus In db.tblkamus Select tblkamus datagridkamus.DataSource = grideng End Sub
Private Sub txtkata_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtkata.KeyUp If e.KeyCode = Keys.Enter Then terjemah() End If End Sub
Private Sub KamusDigitalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KamusDigitalToolStripMenuItem.Click AboutBox1.Show() End SubEnd Class