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
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar