Senin, 12 April 2010
Tugas Aplikasi VB : My Converter Ver.1.2.2
Tampilan :
Splash Screen
Halaman Menu
Tampilan halaman Konversi Desimal ke Biner
Tampilan halaman Konversi Biner ke Desimal
Tampilan halaman konversi rupiah
Program My Converter ini intinya sama seperti tugas yang saya berikan sebelumnya (versi 1.2.1), namun pada versi ini (ver 1.2.2) saya melakukan perubahan-perubahan guna menyesuaikan dengan komponen penilaian, perubahan- perubahannya antara lain :
- menggunakan class, object, property dll dalam melakukan operasi konversi biner > desimal atau sebaliknya
- menambahkan splash screen
- menambahkan about box
- mengganti desain
Source Code :
Public NotInheritable Class SplashScreen1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If (Me.ProgressBar1.Value < 200) Then
Me.ProgressBar1.Value += 1
Else
Me.Timer1.Enabled = False
Me.Visible = False
MainScreen.Show()
End If
End Sub
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If My.Application.Info.Title <> "" Then
ApplicationTitle.Text = My.Application.Info.Title
Else
ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
End If
Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)
Me.ProgressBar1.Value = 1
Me.Timer1.Interval = 1
Me.Timer1.Enabled = True
End Sub
End Class
------------------------------------------------------------
Public Class MainScreen
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DesKeBin.Show()
End Sub
Private Sub Form3_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BinKeDes.Show()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Rupiah.Show()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
AboutBox1.Show()
End Sub
End Class
------------------------------------------------------------------------
public Class ClsConvert
Private nbilangan1_priv
Public Function Bin2Dec(ByVal bil1 As String)
Bin2Dec = Convert.ToByte(bil1, 2)
End Function
Function Dec2Bin(ByVal bil1 As Long) As String
Do Until bil1 = 0
If (bil1 Mod 2) Then Dec2Bin = "1" & Dec2Bin Else Dec2Bin = "0" & Dec2Bin
bil1 = bil1 \ 2
Loop
End Function
Public Property nbilangan1() As Integer
Get
nbilangan1 = nbilangan1_priv
End Get
Set(ByVal value As Integer)
nbilangan1_priv = value
End Set
End Property
End Class
--------------------------------------------------
Public Class DesKeBin
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
Dim x As Integer
Dim objCls As ClsConvert
objCls = New ClsConvert
x = objCls.Dec2Bin(tb1.Text)
tb2.Text = x
objCls.nbilangan1 = tb2.Text
MsgBox(objCls.nbilangan1)
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"
btn1.Enabled = True
End Sub
Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.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
End Sub
Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
MainScreen.Show()
Me.Close()
End Sub
End Class
--------------------------------------------------------------
Public Class BinKeDes
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
Dim x As Byte
Dim objCls As ClsConvert
objCls = New ClsConvert
x = objCls.Bin2Dec(Val(tb1.Text))
tb2.Text = x
objCls.nbilangan1 = tb2.Text
MsgBox(objCls.nbilangan1)
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"
btn1.Enabled = True
End Sub
Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.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
MainScreen.Show()
Me.Close()
End Sub
End Class
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
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
Langganan:
Postingan (Atom)