Selasa, 09 Maret 2010

Tugas Aplikasi VB : Converter Ver 1.2

Converter ver 1.2 by Muhammad Anwar

Tampilan halaman Home :

1. Anda harus memilih tipe konversi apa yang diinginkan. Misalkan anda ingin mengkonversi nilai mata uang rupiah, maka anda harus klik "konversi rupiah"

Tampilan halaman Konversi Rupiah :


2. Klik tombol "mulai" untuk memulai operasi konversi

3. Pilih mata uang yang anda inginkan untuk hasil konversi (jangan lupa isi nilai rupiahnya terlebih dahulu)

Tampilan hasil Konversi :

4. Klik tombol "Ulangi" untuk memulai proses kembali, "Home" untuk kembali ke halaman utama, "selesai" untuk keluar program, "update" untuk mengupdate exchange rate terkini (fitur belum tersedia)

Klik tombol "Home" untuk kembali ke halaman pertama



Kali ini kita akan mencoba Konversi Desimal Ke Biner

1. Klik tombol "Desimal ke Biner"

Halaman konversi desimal ke biner


2. Klik tombol "Mulai" untuk memulai operasi
3. Isi angka desimal yang anda ingin konversi ke biner di textbox 1, dan klik tombol " konversi ke biner"

Halaman Hasil Konversi

4. Untuk mengulangi operasi anda bisa mengklik "Ulangi", "Home" untuk kembali ke halaman awal, "Selesai" untuk menutup program


Untuk membuka konverter Biner ke desimal anda harus mengklik "Home" terlebih dahulu lalu klik "Biner ke Desimal"

Langkah-langkah selanjutnya sama dengan Desimal ke Biner

Tampilan menutup program



SOURCE CODE

Form Home :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aForm As Form1
aForm = New Form1
aForm.Show()
End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
bForm As Form2
bForm = New Form2
bForm.Show()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim cForm As Form4
cForm = New Form4
cForm.Show()
End Sub

Form Konversi Rupiah :

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim o As Integer
o = MsgBox("Yakin keluar?", MsgBoxStyle.OkCancel + MsgBoxStyle.Question, "Keluar")
If o = vbOK Then
MsgBox("Terima kasih telah menggunakan program saya!", MsgBoxStyle.OkOnly, "Bye!")
End
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim bForm As Form3
bForm = New Form3
bForm.Show()
Me.Close()
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim USD As String
Dim YEN As String
Dim Euro As String
Dim hasil As String

USD = 0.00015
YEN = 0.0098
Euro = 0.00011

Select Case ComboBox1.Text
Case Is = "USD"
hasil = TextBox1.Text * USD
Case Is = "Yen"
hasil = TextBox1.Text * YEN
Case Is = " Euro"
hasil = TextBox1.Text * Euro

End Select
TextBox2.Text = hasil
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Enabled = True
TextBox2.Enabled = True
ComboBox1.Enabled = True
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()
Button1.Text = "Ulangi"
End Sub

Form Konversi Desimal ke biner

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
Dim x As Integer
x = tb1.Text
tb2.Text = Dec2Bin(x)
End Sub

'Fungsi untuk membuat menjadi biner
Function Dec2Bin(ByVal n As Long) As String
Do Until n = 0
If (n Mod 2) Then Dec2Bin = "1" & Dec2Bin Else Dec2Bin = "0" & Dec2Bin
n = n \ 2
Loop
End Function

Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
tb1.Enabled = True
tb2.Enabled = True
tb1.Text = ""
tb2.Text = ""
tb1.Focus()
btn2.Text = "Ulangi"

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim o As Integer
o = MsgBox("Yakin keluar?", MsgBoxStyle.OkCancel + MsgBoxStyle.Question, "Keluar")
If o = vbOK Then
MsgBox("Terima kasih telah menggunakan program saya!", MsgBoxStyle.OkOnly, "Bye!")
End
End If
End Sub

Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
Dim bForm As Form3
bForm = New Form3
bForm.Show()
Me.Close()
End Sub

Form Biner ke Desimal

Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
Dim x As String
x = tb1.Text
Dim b As Byte = Convert.ToByte(x, 2)
tb2.Text = b
End Sub

Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
tb1.Enabled = True
tb2.Enabled = True
tb1.Text = ""
tb2.Text = ""
tb1.Focus()
btn2.Text = "Ulangi"

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim o As Integer
o = MsgBox("Yakin keluar?", MsgBoxStyle.OkCancel + MsgBoxStyle.Question, "Keluar")
If o = vbOK Then
MsgBox("Terima kasih telah menggunakan program saya!", MsgBoxStyle.OkOnly, "Bye!")
End
End If
End Sub

Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
Dim bForm As Form3
bForm = New Form3
bForm.Show()
Me.Close()
End Sub

Tidak ada komentar:

Posting Komentar